if a five digit number is input through the keyboard, write
a program to calculate the sum of its digits.
(hint:-use the modulus operator.'%')
Answer Posted / jegadeesh
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
scanf("%d",&i);
if((i%9)==0)
printf("The sum of digit is 9");
else
{
j=i%9;
printf("%d",j);
}
}
| Is This Answer Correct ? | 29 Yes | 33 No |
Post New Answer View All Answers
Explain the advantages and disadvantages of macros.
Is fortran still used today?
What is a good way to implement complex numbers in c?
Can you think of a logic behind the game minesweeper.
What is main () in c language?
write a c program to calculate sum of digits till it reduces to a single digit using recursion
Can we use any name in place of argv and argc as command line arguments?
What is a const pointer?
Disadvantages of C language.
What is wrong in this statement?
Subtract Two Number Without Using Subtraction Operator
What is the explanation for cyclic nature of data types in c?
Explain what’s a signal? Explain what do I use signals for?
What are the modifiers available in c programming language?
What are the c keywords?