Advertisement

Summetion of numbers, U entered


#include<stdio.h>
#include<conio.h>
main()
{
long int A,a,b,c,d,e,f,g,h,sum;
printf("Enter the five digit number=");
scanf("%ld",&A);
a=A%10;
b=A%100;
c=b/10;
d=A%1000;
e=d/100;
f=A%10000;
g=f/1000;
h=A/10000;
sum=a+c+e+g+h;
printf("\nThe sum of the digits of the number entered=%ld",sum);
getch();
return 0;
}

No comments:

Post a Comment

Please comment bellow. Share your knowledge