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 sizeof a keyword in c?
What are the differences between new and malloc in C?
How do I use void main?
In a switch statement, what will happen if a break statement is omitted?
What are types of functions?
What is the meaning of c in c language?
How can I swap two values without using a temporary?
What is c programming structure?
What are inbuilt functions in c?
How to establish connection with oracle database software from c language?
What are the modifiers available in c programming language?
What is the scope of static variable in c?
Write a program to swap two numbers without using a temporary variable?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.