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

try this....

#include<stdio.h>
int main()
{
int n,m,sum=0;
scanf("%d",&n);
for(m=0;((m=n%10)!=0);n=(n/10))
sum+=m;
printf("count is %d\n",sum);
}

Is This Answer Correct ?    13 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of objects used in c?

971


What do you understand by normalization of pointers?

1002


What is pivot in c?

973


What is nested structure with example?

1011


What are the types of macro formats?

1058


Where are some collections of useful code fragments and examples?

1106


Difference between linking and loading?

1058


What are static variables in c?

1027


Explain how do you determine the length of a string value that was stored in a variable?

1092


What does %p mean?

1031


Why does not c have an exponentiation operator?

997


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3913


What are the storage classes in C?

1065


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2577


which type of aspect you want from the student.

2114