Answer Posted / jay soni
#include<stdio.h>
#include<conio.h>
void main()
{
int n,sum=0,r;
printf("enter the value");
scanf("%d",&n);
while(n>0)
{
r=n%10;
n=n/10;
sum=sum+r;
}
printf("\nsum of digits is %d",sum);
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain what is the advantage of a random access file?
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
What is a good way to implement complex numbers in c?
Can you explain the four storage classes in C?
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
Do you know pointer in c?
explain what is fifo?
Why we use break in c?
What is the use of getchar functions?
How can I split up a string into whitespace-separated fields?
What is the function of multilevel pointer in c?
How do I copy files?
What is chain pointer in c?
How can a process change an environment variable in its caller?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above