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
Between macros and functions,which is better to use and why?
Difference between Shallow copy and Deep copy?
What is the difference between array and pointer in c?
What are the benefits of c language?
How can you restore a redirected standard stream?
What is meant by realloc()?
How to throw some light on the b tree?
Explain #pragma statements.
What is signed and unsigned?
How many main () function we can have in a project?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
Explain what are the advantages and disadvantages of a heap?
Explain what is the benefit of using const for declaring constants?
What is the difference between Printf(..) and sprint(...) ?
What is the code for 3 questions and answer check in VisualBasic.Net?