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 are structure members?
What is unsigned int in c?
How can I read in an object file and jump to locations in it?
Explain goto?
Explain what is a pragma?
what is ur strangth & weekness
What is the code in while loop that returns the output of given code?
Why c language?
What is sizeof in c?
Which is better pointer or array?
Explain what are bus errors, memory faults, and core dumps?
Explain low-order bytes.
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
What is the purpose of type declarations?
Where static variables are stored in c?