Answer Posted / vani
//sum of digits in c//
#include<stdio.h>
#include<conio.h>
void main()
{
int n,r,sum=0;
clrscr();
printf("\n enter the number:");
scanf("%d",&n);
while(n!=0)
{
r=n%10;
sum=sum+r;
n=n/10;
}
printf("sum=%d");
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of the statement: strcat (S2, S1)?
Describe newline escape sequence with a sample program?
Why pointers are used?
What is the difference between the = symbol and == symbol?
What is modeling?
I need a sort of an approximate strcmp routine?
Is malloc memset faster than calloc?
What is the size of structure in c?
In C language, a variable name cannot contain?
Explain function?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
Do variables need to be initialized?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
What should malloc() do?
Explain 'far' and 'near' pointers in c.