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
Does c have an equivalent to pascals with statement?
How can I copy just a portion of a string?
how to write optimum code to divide a 50 digit number with a 25 digit number??
How many levels of pointers have?
What is .obj file in c?
Why header files are used?
What is || operator and how does it function in a program?
Are comments included during the compilation stage and placed in the EXE file as well?
which type of aspect you want from the student.
What is an auto variable in c?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
What are derived data types in c?
Can a local variable be volatile in c?
What is the difference between int main and void main in c?
Explain built-in function?