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 sizeof array?
List the variables are used for writing doubly linked list program.
write an algorithm to display a square matrix.
Tell me what are bitwise shift operators?
c language interview questions & answer
What is %lu in c?
What is time complexity c?
What is indirection in c?
When should a far pointer be used?
What is void main ()?
Explain how do you determine whether to use a stream function or a low-level function?
Is main is user defined function?
How do I read the arrow keys? What about function keys?
How do we open a binary file in Read/Write mode in C?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.