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 sizeof int in c?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
What are type modifiers in c?
what do you mean by inline function in C?
What is the meaning of typedef struct in c?
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
What does %p mean c?
Explain which function in c can be used to append a string to another string?
What is the use of parallelize in spark?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
What is string function in c?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
what is the role you expect in software industry?
What is optimization in c?