0

How do I solve it

No one likes homework, but your math teacher has given you an assignment to find the sum of the first N numbers. Let’s save some time by creating a program to do the calculation for you! Take a number N as input and output the sum of all numbers from 1 to N (including N). Sample Input 100 Sample Output 5050 Explanation: The sum of all numbers from 1 to 100 is equal to 5050.

6th Dec 2021, 10:46 PM
Kevin
1 Answer
+ 2
N = int(input()) s=0; i=1 while (i<=N): s +=i i +=1 print(s) https://code.sololearn.com/csvEi1H20oFS
7th Dec 2021, 12:33 AM
SoloProg
SoloProg - avatar