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

What is advantage of pointer in c?

1179


Are enumerations really portable?

1020


Why is c called c not d or e?

1094


Why we not create function inside function.

2190


How to compare array with pointer in c?

1099


Here is a good puzzle: how do you write a program which produces its own source code as output?

1090


what is the format specifier for printing a pointer value?

1016


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

1948


Does c have an equivalent to pascals with statement?

993


How does sizeof know array size?

1111


a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f

2145


What is the difference between typedef struct and struct?

1101


What is the difference between c and python?

1163


What is the use of a conditional inclusion statement in C?

1057


How does free() know explain how much memory to release?

1052