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

#include<stdio.h>
#include<conio.h>
int main()
{
int n,m,d,m1,s=0,s1;
printf("enter the number ");
scanf("%d",&n);
m=n%10;
d=n/10;
while(d>=10)
{
m1=d%10;
d=d/10;
s=s+m1;
}
s1=s+m+d;
printf("\nThe sum of digits is ");
printf("%d",s1);
getch();
}

Is This Answer Correct ?    7 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how do you determine a file’s attributes?

1044


What is the modulus operator?

1208


what is the role you expect in software industry?

2143


What functions are in conio h?

1184


How many levels of pointers can you have?

1188


What is .obj file in c?

1074


Is return a keyword in c?

1075


What is the use of printf() and scanf() functions?

1128


What are the main characteristics of c language describe the structure of ac program?

1211


What is the difference between new and malloc functions?

1122


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

1112


given post order,in order construct the corresponding binary tree

2781


What is a pointer variable in c language?

1103


Do you know null pointer?

1021


can anyone suggest some site name..where i can get some good data structure puzzles???

2082