Professional Documents
Culture Documents
Loops ICW
Loops ICW
• Trying each one by yourself, adding your answers directly to this document. For
questions requiring code, you may provide pseudocode or executable code written
in Google Colab.
• Discussing the questions with your team and agreeing on the best answer and
editing your answer as needed.
1. Write a while loop in pseudocode that sums all the numbers from 1 to 5.
3. Write a loop of your choice that sums only the even numbers from 1-10.
4. Write a loop that sums all the numbers from 1 to n, where “n” is a value given to
you by the user.
5. Write a loop that sums all the numbers from n down to 1, where “n” is a value
given to you by the user. You may assume n > 1.
6. Write a loop that calculates n! (n factorial, ex: 4! = 1x2x3x4) where “n” is a value
given to you by the user. You may assume n > 0.
7. Write a loop that sums all the numbers from m to n, where “m” and “n” are both
user given values. You may assume m>n.
1 6
3 4
.
. .
B .
2 .
7 .