write a 'c' program to sum the number of integer values
Answer Posted / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int n,m,m1,s=0,d,sum;
printf("\nEnter the number ");
scanf("%d",&n);
m=n%10;
d=n/10;
while(d>=10)
{
m1=d%10;
d=d/10;
s =s+m1;
}
sum=s+m+d;
printf("\nSum is %d",sum);
getch();
}
| Is This Answer Correct ? | 4 Yes | 15 No |
Post New Answer View All Answers
What are the uses of null pointers?
Is null always equal to 0(zero)?
Explain what is the difference between a free-standing and a hosted environment?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
Explain about block scope in c?
What is an example of structure?
Explain how can a program be made to print the name of a source file where an error occurs?
How can I find the modification date and time of a file?
Who is the main contributor in designing the c language after dennis ritchie?
write a program to copy the string using switch case?
Difference between malloc() and calloc() function?
Explain what is output redirection?
Can a program have two main functions?
why we wont use '&' sing in aceesing the string using scanf
What is spaghetti programming?