Sunday, October 25, 2009

11.PROGRAM TO ADD 5 DIGIT NO.

//WAP TO ADD 5 DIGIT NO.
#include
#include
void main()
{
int a,b,b1,c1,c,d1,d,e,f,z;
clrscr();
printf("Enter the no.=");
scanf("%d",&z);
a=z/10000;
b=z/1000;
b1=b%10;

c=z/100;
c1=c%10;
d=z/10;
d1=d%10;
e=z%10;
f=a+b1+c1+d1+e;
printf("\n\nSUM=%d",f);
getch();
}
/******OUTPUT******
Enter the no.=12345


SUM=15
*/


No comments:

Post a Comment

Programming the Whole World!