Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / rashmi sharma

#include<sthio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,f,g,h,i,j,k,l;
printf("enter a five digit number");
scanf("%d",&a);
b=a%10;
c=a/10;
d=c%10;
e=c/10;
f=e%10;
g=e/10;
h=g%10;
i=g/10;
j=i%10;
k=i/10;
l=b+d+f+h+j;
printf("sum of the digit=%d",l);
getch();
}

Is This Answer Correct ?    85 Yes 41 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you generate random numbers in C?

1164


What is a function in c?

1515


Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant

1097


What is difference between main and void main?

1140


What is the use of pragma in embedded c?

1024


What is a program flowchart and how does it help in writing a program?

1102


what is the difference between 123 and 0123 in c?

1169


Explain the process of converting a Tree into a Binary Tree.

2627


What's the right way to use errno?

1101


Write a program to print numbers from 1 to 100 without using loop in c?

1043


Are local variables initialized to zero by default in c?

1000


What is pre-emptive data structure and explain it with example?

3680


How can I read a binary data file properly?

1111


What is the total generic pointer type?

1123


Explain the priority queues?

1051