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
If null and 0 are equivalent as null pointer constants, which should I use?
What is use of bit field?
What is a node in c?
Is main an identifier in c?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
What is the meaning of && in c?
Differentiate fundamental data types and derived data types in C.
What are the standard predefined macros?
Can you apply link and association interchangeably?
Why c is called free form language?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What are static variables in c?
Is this program statement valid? INT = 10.50;
What is the size of array float a(10)?
What are the valid places to have keyword “break”?