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

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;
}
printf("\nsum of digits is %d",sum);
}

Is This Answer Correct ?    57 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are identifiers c?

1020


all c language question

2377


Why do we need volatile in c?

1118


What is function prototype in c with example?

1003


please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics

3275


When is a “switch” statement preferable over an “if” statement?

1072


How many bytes is a struct in c?

1105


What is meant by type specifiers?

1082


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2412


Under what circumstances does a name clash occur?

1156


What is a null pointer in c?

1124


Explain argument and its types.

993


Explain high-order bytes.

1061


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1898


Differentiate call by value and call by reference?

916