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 / amit amar mahesh bhava

#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 ?    7 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

can any one tel me wt is the question pattern for NIC exam

2025


What does sizeof function do?

1254


Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

1154


How to compare array with pointer in c?

1168


What is "Hungarian Notation"?

1169


What is a macro, and explain how do you use it?

1126


What is the best way to store flag values in a program?

1124


explain what are actual arguments?

1144


Differentiate between ordinary variable and pointer in c.

1253


What is the difference between variable declaration and variable definition in c?

1105


Explain Function Pointer?

1244


What are the 4 types of unions?

1089


How will you declare an array of three function pointers where each function receives two ints and returns a float?

1431


What is bubble sort technique in c?

1039


Explain the use of bit fieild.

1198