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...

how to find sum of digits in C?

Answer Posted / bhagwat

main()
{
int n,i,sum=0,r;
printf("enter the value");
scanf("%d",&n);
while(n!=0)
{
r=n%10;
n=n/10;
sum=sum+r;
}

Is This Answer Correct ?    53 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of using macro in c language?

1142


p*=(++q)++*--p when p=q=1 while(q<=6)

1768


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3831


Why do we use return in c?

1013


How can I find the modification date and time of a file?

1087


Can you write the algorithm for Queue?

2128


What is pragma in c?

1222


What is the translation phases used in c language?

1125


Is linux written in c?

1046


What is the use of volatile?

1096


What are the complete rules for header file searching?

1094


Define the scope of static variables.

1137


What is a method in c?

1158


Explain pointer. What are function pointers in C?

1090


What is a keyword?

1175