Five digit's number's sum

Write a program to take the five digit input through the keyboard,and show its sum.

#include
#include

void main(void)
{

int a,d,s,g,f,z,x,c,v,b,h;

printf("Enter the five-digit number:");

scanf("%d",&a);

s=a%10;

d=a/10;

f=d%10;

g=a/100;

z=g%10;

x=a/1000;

c=x%10;

v=a/10000;

b=v%10;

h=s+f+z+c+b;

printf("The sum is %d",h);

getch();

}

Comments

Popular posts from this blog

Tip of the Day # 13

Governor Generals of Pakistan