Program to find the sum of digits of a given number until
the sum becomes a single digit
Answer Posted / somasundaram
#include<stdio.h>
#include<conio.h>
void main()
{
unsigned int no;
clrscr();
printf("Enter number : ");
scanf("%d", &no);
if(no==0)
printf("sum = 0");
else
{
no=no%9;
if(no==0)
printf("sum = 9");
else
printf("sum = %d", no);
}
getch();
}
| Is This Answer Correct ? | 9 Yes | 5 No |
Post New Answer View All Answers
Which is better oop or procedural?
What is the difference between fread and fwrite function?
Explain what are the advantages and disadvantages of a heap?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
How can I prevent another program from modifying part of a file that I am modifying?
Explain what is the most efficient way to store flag values?
Function calling procedures? and their differences? Why should one go for Call by Reference?
What is function in c with example?
What is void pointers in c?
In C language, a variable name cannot contain?
Write a program to implement queue.
Why is c called a mid-level programming language?
How is a structure member accessed?
When should you use a type cast?