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 does the characters “r” and “w” mean when writing programs that will make use of files?
Is it cc or c in a letter?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
Is c call by value?
Can the “if” function be used in comparing strings?
What is the process to create increment and decrement stamen in c?
What is the difference between char array and char pointer?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
Tell me the use of bit field in c language?
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
Can you please explain the difference between exit() and _exit() function?
What is property type c?
diff between exptected result and requirement?
find out largest elemant of diagonalmatrix
What is difference between Structure and Unions?