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 / jegadeesh
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
scanf("%d",&i);
if((i%9)==0)
printf("The sum of digit is 9");
else
{
j=i%9;
printf("%d",j);
}
}
| Is This Answer Correct ? | 29 Yes | 33 No |
Post New Answer View All Answers
Why do we use pointer to pointer in c?
Differentiate between new and malloc(), delete and free() ?
What is c basic?
What are the preprocessor categories?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
Here is a neat trick for checking whether two strings are equal
what is event driven software and what is procedural driven software?
What is maximum size of array in c?
What is a rvalue?
Why is c so important?
List the difference between a 'copy constructor' and a 'assignment operator' in C?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
How a string is stored in c?
How reliable are floating-point comparisons?
Which is better pointer or array?