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 / nishant rai

#include<stdio.h>
#include<conio.h>
void main()
{
int num=0,sum=0,k=0;
pirntf("enter the number\n");
scanf("%d",num);
while(num!=0);
{
k=num%10;
sum=sum+k;
num=num/10;
}
printf("%d",sum);
getch();
}

Is This Answer Correct ?    13 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Suggesting that there can be 62 seconds in a minute?

1016


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

2041


Explain what is the difference between null and nul?

1101


What is realloc in c?

1038


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

1224


Explain what are its uses in c programming?

1036


What is #pragma statements?

1065


What is the use of sizeof () in c?

1009


Why should I use standard library functions instead of writing my own?

1223


write a program to copy the string using switch case?

2865


How reliable are floating-point comparisons?

1058


Do pointers take up memory?

1104


write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1

3876


Can math operations be performed on a void pointer?

1013


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

1218