if a five digit number is input through the keyboard, write
a program to calculate the sum of its digits.
(hint:-use the modulus operator.'%')
Answer Posted / nishant rai
#include<stdio.h>
#include<conio.h>
void main()
{
int num=0,sum=0,k=0;
pirntf("enter the number\n");
scanf("%d",num);
while(num!=0);
{
k=num%10;
sum=sum+k;
num=num/10;
}
printf("%d",sum);
getch();
}
| Is This Answer Correct ? | 13 Yes | 14 No |
Post New Answer View All Answers
How can you tell whether two strings are the same?
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
Tell us two differences between new () and malloc ()?
In a header file whether functions are declared or defined?
Is that possible to store 32768 in an int data type variable?
What is meant by realloc()?
What is volatile variable in c with example?
How can I read data from data files with particular formats?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
Write a code to remove duplicates in a string.
Write a C program in Fibonacci series.
What are the properties of union in c?
pierrot's divisor program using c or c++ code
What is n in c?
What is pragma in c?