Professional Documents
Culture Documents
AMAT 150 Exercise
AMAT 150 Exercise
WARM UP
1. The source code below was compiled
but an error occurred. The error message
is given below. Find the bug.
2. The program below was compiled but
errors were found. There are three bugs in
the program. Find them.
3. What does the program below
do?
4. If s=5, what is the final output of
the program below?
5. The program below gets all integers between 1 and
1000 whose sum of digits is 17. The covered line allows
for the printing of the integers satisfying the given
condition. Determine this line.
6. Write a program that outputs
the first n terms of the Fibonacci
sequence
1 1 2 3 5 8 13 21
7. Write a program which:
Asks how many odd numbers you want to use.
Reads in the number of odd numbers to use(16 would be
sufficient to test your program).
Sums this many odd numbers, starting from 1 (Do not use
the formula for the sum of an arithmetic progression!)