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

Program to find the sum of digits of a given number until
the sum becomes a single digit

Answer Posted / rama krishna sidhartha

int n = 1234; //any numer of you want sum
int sum = 0;
void main()
{
clrscr();
while (n > 0)
{
int p = n % 10;
sum = sum + p;
n = n / 10;
}
printf("%d",sum);
getch();
}

Is This Answer Correct ?    49 Yes 75 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between Structure and Unions?

1207


List a few unconditional control statement in c.

944


When is a null pointer used?

1076


What is modeling?

1014


What is variable and explain rules to declare variable in c?

1038


What does the error message "DGROUP exceeds 64K" mean?

1182


Once I have used freopen, how can I get the original stdout (or stdin) back?

1048


What is const and volatile in c?

1003


Explain how can I read and write comma-delimited text?

1131


Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)

1240


What is the purpose of main( ) in c language?

1112


What are dangling pointers? How are dangling pointers different from memory leaks?

1251


Is return a keyword in c?

1043


How can I manipulate strings of multibyte characters?

1094


Write a program which returns the first non repetitive character in the string?

1074