write a program to sum of its digit with using control
structure or with out using loop. for ex: let the number is
25634 then answer will be=2+5+6+3+4=20
Answer Posted / rama krishna sidhartha
#include <stdio.h>
#include<conio.h>
void main()
{
int s=0,c,n;
clrscr();
printf("\n ENTER A VALUE : ");
scanf("%d",&n);
while(n>0)
{
c=n%10;
s=s+c;
n=n/10;
}
printf("\n THE SUM OF INDIVIDUAL DIGITS : %d",s);
getch();
}
Is This Answer Correct ? | 10 Yes | 10 No |
Post New Answer View All Answers
Define C in your own Language.
What is operator promotion?
What are volatile variables in c?
Explain how can I make sure that my program is the only one accessing a file?
how to introdu5ce my self in serco
Explain how to reverse singly link list.
When should you use a type cast?
write a program to print data of 5 five students with structures?
What is a good way to implement complex numbers in c?
what is stack , heap ,code segment,and data segment
How can I implement sets or arrays of bits?
How can you find the day of the week given the date?
Can a pointer be volatile in c?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
Explain how are portions of a program disabled in demo versions?