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 restrict keyword in c?
what is the syallabus of computer science students in group- 1?
What is #define in c?
Explain what is a pragma?
What is ambagious result in C? explain with an example.
Can you apply link and association interchangeably?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
Do character constants represent numerical values?
What is the purpose of clrscr () printf () and getch ()?
Write a program to identify if a given binary tree is balanced or not.
What is nested structure in c?
What is a program flowchart and how does it help in writing a program?
What are the types of pointers?
what is event driven software and what is procedural driven software?
How can you read a directory in a C program?