123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
Program for finding the sum of digits of a five digit number.

--------------------------------------------------------------------------------



#include <stdio.h>
#include <conio.h>
void main()
{
int n,o,p,q,r,s;
char c;
clrscr();
repeat: s=0;
printf("

Enter a five digit no.:- ");
scanf("%d",&n);
o=n%10000;
p=o%1000;
q=p%100;
r=q%10;
s=(n/10000)+(o/1000)+(p/100)+(q/10)+r;
printf("The sum of its digits is %d.",s);
fflush(stdin);
printf ("

Do you want to continue?(y/n):- ");
scanf("%c",&c);
if (c=='y')
goto repeat;
getch();
}
 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG