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
Under what circumstances does a name clash occur?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
Explain how can you be sure that a program follows the ansi c standard?
Explain what is meant by 'bit masking'?
How can you check to see whether a symbol is defined?
What is the difference between single charater constant and string constant?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
Does sprintf put null character?
How can I read data from data files with particular formats?
Can you please compare array with pointer?
Describe how arrays can be passed to a user defined function
What is volatile variable in c?
Why clrscr is used after variable declaration?
Which is better between malloc and calloc?
Explain what is the benefit of using an enum rather than a #define constant?