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 is sizeof array in c?
Explain what is the benefit of using const for declaring constants?
Who developed c language and when?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
Why c is a procedural language?
Explain setjmp()?
Explain enumerated types.
Why do we use static in c?
What is an endless loop?
Can we change the value of static variable in c?
Are the variables argc and argv are always local to main?
How do you define structure?
How is pointer initialized in c?
Why we not create function inside function.
Why isn't it being handled properly?