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
What is a far pointer in c?
What are pointers in C? Give an example where to illustrate their significance.
What is the difference between ‘g’ and “g” in C?
Explain the advantages and disadvantages of macros.
What is a pointer in c?
What is the use of bit field?
What is the use of header files?
What are the 32 keywords in c?
What is pointer & why it is used?
Why isnt any of this standardized in c?
Is it cc or c in a letter?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
Do you know what are the properties of union in c?
What are the types of macro formats?
can we have joblib in a proc ?