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 / rajrartan singh

#include<stdio.h>
#include<conio.h>
void main();
{
int n,d1,d2,d3,d4,d5,sum;
ptintf("enter the five digit no.");
scanf("d",&n);
s=d1+d2+d3+d4+d5;
getch();
}

Is This Answer Correct ?    4 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how do you execute a c program in unix.

634


What is strcmp in c?

592


Give the rules for variable declaration?

669


What is a stream?

639


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1454






how to construct a simulator keeping the logical boolean gates in c

1722


What does volatile do?

559


Can we declare variable anywhere in c?

533


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

557


Explain the priority queues?

617


There seem to be a few missing operators ..

611


What is include directive in c?

638


Why is event driven programming or procedural programming, better within specific scenario?

1949


What is a void pointer? When is a void pointer used?

614


If errno contains a nonzero number, is there an error?

796