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
Explain what are binary trees?
What is meant by type casting?
Explain what are the different file extensions involved when programming in c?
What is an example of structure?
What does c mean before a date?
What does 3 periods mean in texting?
Explain how do you print an address?
How does #define work?
code for find determinent of amatrix
Write a program to print all permutations of a given string.
How are strings stored in c?
How many levels of pointers can you have?
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
Why c is called object oriented language?
What is %g in c?