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 a macro, and explain how do you use it?
What is %d called in c?
Explain low-order bytes.
Explain b+ tree?
what is recursion in C
What is the difference between single charater constant and string constant?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
in iso what are the common technological language?
What is getche() function?
Write a program to find the biggest number of three numbers in c?
program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)
How can I write a function that takes a format string and a variable number of arguments?
What's the difference between constant char *p and char * constant p?