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
What does *p++ do?
What is the purpose of main( ) in c language?
show how link list can be used to repersent the following polynomial i) 5x+2
What does it mean when the linker says that _end is undefined?
What are the 3 types of structures?
What is the difference between abs() and fabs() functions?
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
Why does not c have an exponentiation operator?
What is null in c?
How are 16- and 32-bit numbers stored?
List some of the static data structures in C?
Explain About fork()?
How can you increase the allowable number of simultaneously open files?
What are actual arguments?
What is the difference between malloc() and calloc() function in c language?