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

Explain how are 16- and 32-bit numbers stored?

1305


Write a program to print fibonacci series without using recursion?

1216


What is call by value in c?

1050


i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....

2042


What is the maximum no. of arguments that can be given in a command line in C.?

1199


Who invented b language?

1471


please give me some tips for the placement in the TCS.

2154


What are the uses of null pointers?

1193


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

8116


What is structure of c program?

1227


Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)

1321


What does %d do in c?

1010


Are pointers integers in c?

1121


Is c call by value?

1076


How are portions of a program disabled in demo versions?

1342