Program to find the sum of digits of a given number until
the sum becomes a single digit
Answer Posted / sohini khan
main()
{int n,p,s=0;
while(n>0)
{
p=n%10;
s=s+p;
n=n/10;
}
printf("%d",s);
getch(),
}
| Is This Answer Correct ? | 29 Yes | 43 No |
Post New Answer View All Answers
code for replace tabs with equivalent number of blanks
List the difference between a While & Do While loops?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
What are conditional operators in C?
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
What is wrong with this statement? Myname = 'robin';
What is mean by data types in c?
Why malloc is faster than calloc?
What is spaghetti programming?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
What is pointers in c?
What is the significance of an algorithm to C programming?
What is an endless loop?
Explain how can you tell whether two strings are the same?