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
Explain how are 16- and 32-bit numbers stored?
Write a program to print fibonacci series without using recursion?
What is call by value in c?
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
What is the maximum no. of arguments that can be given in a command line in C.?
Who invented b language?
please give me some tips for the placement in the TCS.
What are the uses of null pointers?
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
What is structure of c program?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
What does %d do in c?
Are pointers integers in c?
Is c call by value?
How are portions of a program disabled in demo versions?