CMPSC 201 - Loop Worksheet #5 | Name - |
Write out your answers below or on blank paper.
1. Write a for loop that will sum the integers from 1 to and including 100.
2. Write a for loop that will sum the even integers from 2 to and including 100.
3. Write a for loop that will sum the numbers from the integer variable num1 to and including the integer variable num2. You can assume that both variables are already initialized and that num2 > num1.
4. Write a loop that will calculate the N! where N is a non-zero, positive integer variable that is less than 100.
5. Write a code segment that uses a loop to allow the user to input 10 integers and that displays the final average rounded to the nearest whole number.