Write a program to display the sum of even digits.
Program:
s=0
n=int(input("Enter any no"))
while(n>0):
d=int(n%10)
if(d%2==0):
s=int(s+d)
n=int(n/10)
print("Sum of even digits:",s)
s=0
n=int(input("Enter any no"))
while(n>0):
d=int(n%10)
if(d%2==0):
s=int(s+d)
n=int(n/10)
print("Sum of even digits:",s)
Comments
Post a Comment
If you have any doubt, Please let me know..