Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

if a five digit number is input through the keyboard, write
a program to calculate the sum of its digits.
(hint:-use the modulus operator.'%')

Answer Posted / amit amar mahesh bhava

#include<sthio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,f,g,h,i,j,k,l;
printf("enter a five digit number");
scanf("%d",&a);
b=a%10;
c=a/10;
d=c%10;
e=c/10;
f=e%10;
g=e/10;
h=g%10;
i=g/10;
j=i%10;
k=i/10;
l=b+d+f+h+j;
printf("sum of the digit=%d",l);
getch();
}

Is This Answer Correct ?    7 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you search data in a data file using random access method?

1352


Explain how do you sort filenames in a directory?

1070


i have a written test for microland please give me test pattern

2777


Explain how can I prevent another program from modifying part of a file that I am modifying?

1138


Is c procedural or object oriented?

1083


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

1443


Is main an identifier in c?

1201


shorting algorithmS

2309


Difference between Shallow copy and Deep copy?

2073


int far *near * p; means

3619


please explain every phase in the "SDLC" in the dotnet.

2667


Explain main function in c?

1134


What is NULL pointer?

1141


How can my program discover the complete pathname to the executable from which it was invoked?

1117


what are # pragma staments?

2077