Answer Posted / pooja
main()
{
int n,i,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);
}
| Is This Answer Correct ? | 57 Yes | 11 No |
Post New Answer View All Answers
How do we declare variables in c?
What are the disadvantages of c language?
When can a far pointer be used?
What is the best way to store flag values in a program?
What’s a signal? Explain what do I use signals for?
What is the difference between procedural and declarative language?
Explain the properties of union. What is the size of a union variable
Explain how can I manipulate strings of multibyte characters?
Explain what is the difference between text files and binary files?
Explain what is page thrashing?
What are the 5 types of inheritance in c ++?
What are types of functions?
What is variable declaration and definition in c?
How do you sort filenames in a directory?
What is a macro, and explain how do you use it?