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
Is main is a keyword in c?
how to construct a simulator keeping the logical boolean gates in c
What is the difference between text files and binary files?
What header files do I need in order to define the standard library functions I use?
Explain the difference between null pointer and void pointer.
Explain null pointer.
Explain enumerated types in c language?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
What is else if ladder?
How can I split up a string into whitespace-separated fields?
Differentiate between Macro and ordinary definition.
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
What is const keyword in c?
What is adt in c programming?
How to write a code for implementing my own printf() and
scanf().... Please hep me in this... I need a guidance...
Can you give an coding for c... Please also explain about
the header files used other than #include