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 / k.kavitha
main()
{
int num=0,sum=0,k=0;
pirntf("enter the number\n");
scanf("%d",num);
while(num!=0);
{
k=num%10;
sum=sum+k;
num=num/10;
}
printf("%d",sum);
}
Is This Answer Correct ? | 137 Yes | 90 No |
Post New Answer View All Answers
What is typedef struct in c?
Is c language still used?
What is the meaning of c in c language?
What does #pragma once mean?
What is array of structure in c?
Explain what does the function toupper() do?
Where can I get an ansi-compatible lint?
What are the string functions? List some string functions available in c.
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
What is indirection?
Can we replace the struct function in tree syntax with a union?
Why is python slower than c?
List the different types of c tokens?
What is c preprocessor mean?
How can you draw circles in C?