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

Do you know what are the properties of union in c?

1082


Process by which one bit pattern in to another by bit wise operation is?

1167


in linking some of os executables are linking name some of them

2143


What is the newline escape sequence?

1078


What is the description for syntax errors?

1170


What is file in c preprocessor?

1151


Is null always equal to 0(zero)?

1037


Why main function is special give two reasons?

1546


Explain what is meant by 'bit masking'?

1201


write a program to print data of 5 five students with structures?

2048


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

1146


Who developed c language?

1097


What is a char in c?

999


how to write optimum code to divide a 50 digit number with a 25 digit number??

3270


What is the difference between arrays and pointers?

1130