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

main()
{
int num , sum=0 ;
printf(" enter 5 digit no. " );
scanf(" %d " , num);
while (num!=0)
{ sum+=num%10;
num=num/10;
}
printf("sum is = %d " , sum );
getch();
}

Is This Answer Correct ?    24 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you check to see whether a symbol is defined?

1106


Can you please explain the difference between exit() and _exit() function?

1039


What is actual argument?

1071


What is merge sort in c?

1053


What is the heap in c?

1088


What is the difference between ā€˜g’ and ā€œgā€ in C?

4018


formula to convert 2500mmh2o into m3/hr

1004


What is file in c preprocessor?

1160


What is the difference between null pointer and wild pointer?

1205


How many levels of indirection in pointers can you have in a single declaration?

1095


How reliable are floating-point comparisons?

1108


The difference between printf and fprintf is ?

1298


What is difference between scanf and gets?

1289


What are pointers really good for, anyway?

1072


Can we declare a function inside a function in c?

1048