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
how do you execute a c program in unix.
Define Array of pointers.
How can I automatically locate a programs configuration files in the same directory as the executable?
What are the 5 elements of structure?
What is array of structure in c?
What is c system32 taskhostw exe?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
write a program to generate address labels using structures?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
How can I determine whether a machines byte order is big-endian or little-endian?
Explain how can type-insensitive macros be created?
Does c have class?
What are the types of data structures in c?
Here is a neat trick for checking whether two strings are equal
Explain the use of fflush() function?