write a program to gat the digt sum of a number (et. 15=
>1+5=6)
Answer Posted / sagarsp2010
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum=0,no;
clrscr();
printf("ENTER THE NO. OF TERMS:");
scanf("%d",&n);
for (i=1;i<=5;i++)
{
no=n%10;
sum=sum+no;
n=n/10;
}
printf("sum=%d",sum);
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the difference between printf and scanf in c?
Is c a great language, or what?
Explain the difference between malloc() and calloc() in c?
Difference between strcpy() and memcpy() function?
What is the use of define in c?
Explain what is a 'locale'?
Why do we need a structure?
What is the value of uninitialized variable in c?
what are the 10 different models of writing an addition program in C language?
what is the role you expect in software industry?
What are external variables in c?
What are the disadvantages of c language?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
How does sizeof know array size?
Where are the auto variables stored?