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 / synner

#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
long int num;
int sum=0,temp;
clrscr();
printf("Enter the numbe\n");
scanf("%ld",&num);
while(num!=0)
{
temp=num%10;
sum=sum+temp;
num=num/10;
}
printf("%d",sum);
getch();
}

Is This Answer Correct ?    11 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

2807


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1227


What is bss in c?

1160


What is ctrl c called?

1100


can anyone suggest some site name..where i can get some good data structure puzzles???

2159


will u please send me the placement papers to my mail???????????????????

1885


Is return a keyword in c?

1147


How can I find out how much free space is available on disk?

1104


Tell us the use of fflush() function in c language?

1201


What does & mean in scanf?

1166


Is c is a high level language?

1253


What is wrong with this statement? Myname = 'robin';

1393


Can two or more operators such as and be combined in a single line of program code?

1420


Why is c still so popular?

1101


How are variables declared in c?

1151