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
4. main() { int c=- -2; printf("c=%d",c); }
What is function prototype in c with example?
Explain why can’t constant values be used to define an array’s initial size?
What are the __date__ and __time__ preprocessor commands?
By using C language input a date into it and if it is right?
Who developed c language?
What are the back slash character constants or escape sequence charactersavailable in c?
What are variables and it what way is it different from constants?
How can I find out how much free space is available on disk?
Why structure is used in c?
State the difference between realloc and free.
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
a value that does not change during program execution a) variabe b) argument c) parameter d) none
What does %p mean?
Is c object oriented?