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
What are all different types of pointers in c?
What does volatile do?
When do we get logical errors?
What is class and object in c?
What's a good way to check for "close enough" floating-point equality?
Explain the red-black trees?
What are valid signatures for the Main function?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Explain how can you avoid including a header more than once?
What is openmp in c?
What type of function is main ()?
Why we use break in c?
Describe how arrays can be passed to a user defined function
Can a pointer be static?