CSE 142
- Write a for loop that produces the following output
1 4 9 16 25 36 49 64 81 100
- Write a piece of code that uses a for loop to compute and print the first 12 Fibonacci numbers
1 1 2 3 5 8 13 21 34 55 89 144
-
Write nested for loops to produce the following output
1 2 3 4 5
-
Write nested or loops to produce the following output
1 22 333 4444 55555
-
Determine an expression for each table below, the expression should use line and SIZE to generate the sequence
line value | constant SIZE value | sequence |
---|---|---|
1, 2, 3, 4, 5, 6, ... |
1 |
4, 6, 8, 10, 12, 14, ... |
1, 2, 3, 4, 5, 6, ... |
2 |
6, 8, 10, 12, 14, 16, ... |
line value | constant SIZE value | sequence |
---|---|---|
1, 2, 3, 4, 5, 6, ... |
3 |
13, 17, 21, 25, 29, 33, ... |
1, 2, 3, 4, 5, 6, ... |
5 |
19, 23, 27, 31, 35, 39, ... |
line value | constant SIZE value | sequence |
---|---|---|
1, 2, 3, 4, 5, 6, ... |
4 |
10, 9, 8, 7, 6, 5, ... |
1, 2, 3, 4, 5, 6, ... |
9 |
20, 19, 18, 17, 16, 15, ... |
-
Write an entire program that produces the following hourglass figure as its output using nested for loops
|""""""""""| \::::::::/ \::::::/ \::::/ \::/ || /::\ /::::\ /::::::\ /::::::::\ |""""""""""|