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 / nishant rai
#include<stdio.h>
#include<conio.h>
void 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);
getch();
}
| Is This Answer Correct ? | 13 Yes | 14 No |
Post New Answer View All Answers
Suggesting that there can be 62 seconds in a minute?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
Explain what is the difference between null and nul?
What is realloc in c?
a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none
Explain what are its uses in c programming?
What is #pragma statements?
What is the use of sizeof () in c?
Why should I use standard library functions instead of writing my own?
write a program to copy the string using switch case?
How reliable are floating-point comparisons?
Do pointers take up memory?
write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1
Can math operations be performed on a void pointer?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers