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
What does char * * argv mean in c?
What is the full form of getch?
What are the types of data files?
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
Is there a way to switch on strings?
Do you have any idea how to compare array with pointer in c?
write a program to display all prime numbers
given post order,in order construct the corresponding binary tree
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?
Ow can I insert or delete a line (or record) in the middle of a file?
How are pointers declared in c?
What does malloc () calloc () realloc () free () do?
What does volatile do?
What is an endless loop?
Why do we write return 0 in c?