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

main()
{
int num , sum=0 ;
printf(" enter 5 digit no. " );
scanf(" %d " , num);
while (num!=0)
{ sum+=num%10;
num=num/10;
}
printf("sum is = %d " , sum );
getch();
}

Is This Answer Correct ?    24 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by recursion in c?

1056


Explain how can I prevent another program from modifying part of a file that I am modifying?

1037


Explain how does flowchart help in writing a program?

1061


What is volatile variable in c with example?

997


Why c is called a middle level language?

1052


Can we replace the struct function in tree syntax with a union?

1238


In C, What is the #line used for?

2098


What is the use of pointers in C?

1024


What is main () in c?

1013


how should functions be apportioned among source files?

1058


If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.

2213


Are comments included during the compilation stage and placed in the EXE file as well?

1029


how to build a exercise findig min number of e heap with list imlemented?

2017


What are the back slash character constants or escape sequence charactersavailable in c?

1124


What is #include stdio h and #include conio h?

1040