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 VARIABLE?
How do you print an address?
hi any body pls give me company name interview conduct "c" language only
what is reason of your company position's in india no. 1.
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
Do you know the use of fflush() function?
Write a program to check armstrong number in c?
Which is better malloc or calloc?
Why we write conio h in c?
What is ctrl c called?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
What is the correct code to have following output in c using nested for loop?
What is class and object in c?
What is scope rule in c?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question