Python program to find sum of n natural numbers using for loop
Answers
Answered by
8
Answer:
The program accepts user input using the input function. Next, run loop till the entered number using the for loop and range() function. Next, calculate the sum using a sum = sum + current number formula. At last, after the loop ends, calculate the average using average = sum / n .
MARK AS BRAINLIEST
Answered by
6
- The program accepts user input using the input function. Next, run loop till the entered number using the for loop and range() function. Next, calculate the sum using a sum = sum + current number formula. At last, after the loop ends, calculate the average using average = sum / n .
Similar questions