Python program to calculate the sum of first to n even number


Write a program in python to calculate the sum of first to n even number

----------------------------------

num=int(input("Enter the Limit : "))

sum=0

for i in range(0,num+1,2):

    sum=sum+i

print("sum of all even number is : ",sum)

----------------------------------

Output :-

Enter the Limit : 10

sum of all even number is :  30


Post a Comment

0 Comments