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

What do you mean by keywords in c?

1139


What are 'near' and 'far' pointers?

1031


What is spark map function?

1120


Explain what is the purpose of "extern" keyword in a function declaration?

1063


Write a program for Overriding.

1154


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

1710


What is meant by recursion?

1045


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

2292


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

2214


What is use of integral promotions in c?

1141


What is difference between array and structure in c?

1175


Explain what are header files and explain what are its uses in c programming?

1149


Explain two-dimensional array.

1056


What is difference between scanf and gets?

1261


What is getch () for?

1219