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 / thiruapthi rao
// mainlogic
while(number>0)
{
remainder=number%10;
sum=sum+remainder;
number=number/10;
}
/*
number=123
sum=1+2+3=6
*/
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the difference between single charater constant and string constant?
Explain what is the difference between null and nul?
Which is better oop or procedural?
Why clrscr is used in c?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
What is the difference between declaring a variable and defining a variable?
What is a void pointer? When is a void pointer used?
What is || operator and how does it function in a program?
What is structure of c program?
What is the c language function prototype?
code for replace tabs with equivalent number of blanks
Explain output of printf("Hello World"-'A'+'B'); ?
How can you find the exact size of a data type in c?
What does sizeof return c?
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.