Name: _____________________________________________ Alpha: ___________________
Describe help received: ________________________________________________________
- Due before class on Monday, January 30
- This homework contains code to be submitted electronically.
Put your code in a folder called
hw08and submit using the
- This is an electronic homework and you do not need to print out anything to turn in during class.
- Required reading: Sections 3 (Loop shortcuts) and 4 (Odds & ends) from the Unit 3 notes.
Write a program called
gaussfor.cthat reads an integer \(n\) from the user, and then uses a
forloop to add up the numbers from 1 to \(n\) and print out the sum.
(Note: this is the same program that you wrote for homework 6, except using a for loop instead of a while loop.
Example of running your program:
The sum of numbers from 1 up to 100 is 5050