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
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
Can an array be an Ivalue?
Explain what is output redirection?
can anyone please tell about the nested interrupts?
Write a program in c to replace any vowel in a string with z?
Which one would you prefer - a macro or a function?
Is return a keyword in c?
Explain the difference between the local variable and global variable in c?
Write a C program to count the number of email on text
What is the ANSI C Standard?
How can I open a file so that other programs can update it at the same time?
What is dangling pointer in c?
What are the advantages of c language?
Write a function that will take in a phone number and output all possible alphabetical combinations
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above