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

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

Is This Answer Correct ?    57 Yes 32 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I insert or delete a line (or record) in the middle of a file?

975


What is function prototype in c with example?

1002


How can I use a preprocessorif expression to ?

994


Is a house a shell structure?

1104


What are local variables c?

957


What is meant by recursion?

995


Are comments included during the compilation stage and placed in the EXE file as well?

1028


What is a struct c#?

998


How many types of sorting are there in c?

1010


Do you know the use of 'auto' keyword?

1127


What are all different types of pointers in c?

956


ATM machine and railway reservation class/object diagram

5191


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

2029


In C language what is a 'dangling pointer'?

1062


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

1056