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

write a program to sum of its digit with using control
structure or with out using loop. for ex: let the number is
25634 then answer will be=2+5+6+3+4=20

Answer Posted / thiruapthi rao

// mainlogic
while(number>0)
{
remainder=number%10;
sum=sum+remainder;
number=number/10;
}
/*
number=123
sum=1+2+3=6
*/

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Under what circumstances does a name clash occur?

1161


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

1054


Explain how can you be sure that a program follows the ansi c standard?

1403


Explain what is meant by 'bit masking'?

1125


How can you check to see whether a symbol is defined?

1053


What is the difference between single charater constant and string constant?

1037


What is the time and space complexities of merge sort and when is it preferred over quick sort?

1019


Does sprintf put null character?

991


How can I read data from data files with particular formats?

1006


Can you please compare array with pointer?

1042


Describe how arrays can be passed to a user defined function

1229


What is volatile variable in c?

1057


Why clrscr is used after variable declaration?

1632


Which is better between malloc and calloc?

1124


Explain what is the benefit of using an enum rather than a #define constant?

1172