Header Ads

Python Program to Find Sum and Average of Natural Number Using While Loop


Write Program in Python to Find Sum and Average of Natural Number Using While Loop




Example : Code Program





n = 1
sum = 0
avg = 0.0
while n <= 10:
   
print(n)
    sum += n
    n = n+
1
print("The Sum is :", sum)
avg = sum/
10
print("The Average is :", avg)


Output



Python, Program,Find, Sum, average, Natural,  Numbers,While, for, Loop,
Python Program, Find The Sum,  Natural Numbers, While Loop, Display Natural number, Display Nutural Number and Their Sum, Display Nutural Number and Their Sum and Average, Python Program to Find The Sum of Natural Numbers 1 to 10 Using While Loop

No comments

Powered by Blogger.