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 use of gets and puts?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
What is atoi and atof in c?
regarding pointers concept
swap 2 numbers without using third variable?
What is void main () in c?
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
What are global variables and how do you declare them?
What is the correct declaration of main?
Explain how can I convert a number to a string?
What is use of #include in c?
Why c is called a mid level programming language?
write a program to find out prime number using sieve case?
What is ## preprocessor operator in c?