Program to find the sum of digits of a given number until
the sum becomes a single digit
Answer Posted / sohini khan
main()
{int n,p,s=0;
while(n>0)
{
p=n%10;
s=s+p;
n=n/10;
}
printf("%d",s);
getch(),
}
| Is This Answer Correct ? | 29 Yes | 43 No |
Post New Answer View All Answers
is it possible to create your own header files?
Explain how can a program be made to print the name of a source file where an error occurs?
What is the use of structure padding in c?
List some of the dynamic data structures in C?
How can I prevent another program from modifying part of a file that I am modifying?
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.
Is that possible to add pointers to each other?
How can I use a preprocessorif expression to ?
What is the condition that is applied with ?: Operator?
Can a pointer be null?
Are there namespaces in c?
What does == mean in texting?
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
Are pointers really faster than arrays?
What is context in c?