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
Write a program to print factorial of given number using recursion?
What is dynamic dispatch in c++?
Explain how can I prevent another program from modifying part of a file that I am modifying?
Why doesnt this code work?
What is difference between array and pointer in c?
Why should I use standard library functions instead of writing my own?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
What is conio h in c?
Are comments included during the compilation stage and placed in the EXE file as well?
What is the meaning of c in c language?
Can include files be nested?
what do the 'c' and 'v' in argc and argv stand for?
What is && in c programming?
How many bytes is a struct in c?
how to execute a program using if else condition and the output should enter number and the number is odd only...