Lab 02
C loops
Write a program that asks for a positive integer n and builds a triangle like so:
What is n? 4
*
**
***
****
Fibonacci numbers
Recall that a Fibonacci number is defined such that F(n) is equal to F(n-1) + F(n-2) given that F(1) = F(2) = 1. Write a program that asks for a positive integer n and computes the first n Fibonacci numbers.
Please enter a value: 5
fib(1) is 1
fib(2) is 1
fib(3) is 2
fib(4) is 3
fib(5) is 5
Grades
Write a grading program that asks for a student’s grades. When a negative value is given, compute and output her average. Use this web page to only print out two digits of precision (search for precision).
Enter the next grade: 92
Enter the next grade: 98
Enter the next grade: 100
Enter the next grade: 93
Enter the next grade: -1
The overall grade is 95.75