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 / saurabh vyas
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 ? | 4 Yes | 9 No |
Post New Answer View All Answers
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
How to find a missed value, if you want to store 100 values in a 99 sized array?
Can variables be declared anywhere in c?
What is I ++ in c programming?
What is pointer & why it is used?
Explain what are the different file extensions involved when programming in c?
explain what are actual arguments?
Write a function that will take in a phone number and output all possible alphabetical combinations
How would you rename a function in C?
Can the curly brackets { } be used to enclose a single line of code?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
Can you subtract pointers from each other? Why would you?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
Explain how do you determine whether to use a stream function or a low-level function?
Explain the difference between strcpy() and memcpy() function?