Python Program to print Sum of First 10 Natural Numbers
sum=0
for i in range(1,11,1):
sum=sum+i
print("The sum of first 10 natural numbers is:",sum)
Output:
The sum of first 10 natural numbers is: 55
Sum of Even Numbers
sum=0
for number in range(11):
if number%2==0:
sum=sum+number
print("The sum of even numbers is:",sum)
Output:
The sum of even numbers is: 30
0 टिप्पण्या
कृपया तुमच्या प्रियजनांना लेख शेअर करा आणि तुमचा अभिप्राय जरूर नोंदवा. 🙏 🙏