Showing posts with label WAP to add entered three digits. Show all posts
Showing posts with label WAP to add entered three digits. Show all posts

Tuesday, 28 August 2007

ADD ENTERED DIGITS

WAP to add entered three digits

void main ()

{

int no,r,res;

clrscr ();

printf ("Enter any value: ");

scanf ("%d",&no);

r=res=0;

while (no>0)

{

r=no%10;

no=no/10;

res=(res+r);

}

printf ("Sum is %d",res);

getch ();

}