During this activity, students should be able to:
This activity helps the student develop the following skills, values and attitudes: ability to analyze and synthesize, capacity for identifying and solving problems, and efficient use of computer systems.
Solve the following set of programming exercises using the brainf*ck programming language.
Write a program called first.bf
that reads a digit
d (0 to 9) from the keyboard and prints the first
d lowercase letters of the English alphabet. Example
(user input is in bold):
6 abcdef
Write a program called dup.bf
that reads a digit
d (0 to 9) followed by any character c from
the keyboard and prints a total of d consecutive
c characters. If d is zero, nothing should be
printed. Example (user input is in bold):
6a aaaaaa
Write a program called tri.bf
that reads a digit
character d (0 to 9) from the keyboard and prints a
triangle made out of d rows of asterisks as shown in
the example (user input is in bold):
6 * ** *** **** ***** ******
Write a program called count.bf
that reads a series
of characters from the keyboard (minimum 0, maximum 9
characters) followed by the Enter key, and displays how many
characters were actually typed (excluding the enter character).
The ASCII code for the Enter key is 10. Example (user input is
in bold):
hello 5
Nothing. These are just practice exercises.