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

// assume that num is non-negative.

int sum_digits_recursive ( int num )
{
if ( num == 0 ) return 0;
return (num % 10 + sum_digits_recursive ( num / 10 ));
}

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the role of && operator in a program code?

1061


What is the difference between the = symbol and == symbol?

1106


What is console in c language?

1093


How can I generate floating-point random numbers?

1125


Why doesn't C support function overloading?

2740


What are global variables and how do you declare them?

1087


What is the general form of a C program?

1022


How to create struct variables?

1101


What do mean by network ?

1155


What is a nested loop?

1115


Explain null pointer.

1105


What is p in text message?

976


What does main () mean in c?

1095


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

1387


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

2240