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 / jyoti

#include<stdio.h>
int main()
{
int n,d1,d2,d3,d4,d5,s;
printf("enter a five digit no");
scanf("%d",&n);
d5=n%10;n=n/10;
d4=n%10;n=n/10;
d3=n%10;n=n/10;
d2=n%10;n=n/10;
d1=n%10;
s=d1+d2+d3+d4+d5;
return 0;
}

Is This Answer Correct ?    29 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is an example of a structural homology?

1328


What is variables in c?

1057


What is the symbol indicated the c-preprocessor?

1260


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

1271


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

1108


write a program for the normal snake games find in most of the mobiles.

2266


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

1066


Why cant I open a file by its explicit path?

1041


When is a “switch” statement preferable over an “if” statement?

1161


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

1007


what are the advantages of a macro over a function?

1152


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

1981


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3980


Can we use visual studio for c?

1106


Explain how do you override a defined macro?

1085