Answer Posted / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int n,m,d,m1,s=0,s1;
printf("enter the number ");
scanf("%d",&n);
m=n%10;
d=n/10;
while(d>=10)
{
m1=d%10;
d=d/10;
s=s+m1;
}
s1=s+m+d;
printf("\nThe sum of digits is ");
printf("%d",s1);
getch();
}
| Is This Answer Correct ? | 7 Yes | 11 No |
Post New Answer View All Answers
What is echo in c programming?
Here is a neat trick for checking whether two strings are equal
swap 2 numbers without using third variable?
What are the different types of control structures in programming?
How can I write a function that takes a format string and a variable number of arguments?
What is a char in c?
Differentiate between #include<...> and #include '...'
Why does this code crash?
What is meant by high-order and low-order bytes?
i have a written test for microland please give me test pattern
How old is c programming language?
How many types of errors are there in c language? Explain
How can you invoke another program from within a C program?
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above
what is a constant pointer in C