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
What is the role of && operator in a program code?
What is the difference between the = symbol and == symbol?
What is console in c language?
How can I generate floating-point random numbers?
Why doesn't C support function overloading?
What are global variables and how do you declare them?
What is the general form of a C program?
How to create struct variables?
What do mean by network ?
What is a nested loop?
Explain null pointer.
What is p in text message?
What does main () mean in c?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays