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
Why pointers are used?
Is c procedural or object oriented?
What should malloc(0) do?
What are bitwise shift operators in c programming?
Is there any demerits of using pointer?
What is the difference between ++a and a++?
Why is c still so popular?
i want to know the procedure of qualcomm for getting a job through offcampus
What is difference between %d and %i in c?
Can we increase size of array in c?
What is a structure in c language. how to initialise a structure in c?
What is c++ used for today?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
What are the basic data types associated with c?
Why static is used in c?