Can anyone help me with this problem in C?

Closed Thread

Join Date: Sep 2009
Posts: 2
Reputation: uniquevictory is an unknown quantity at this point 
Solved Threads: 0
uniquevictory uniquevictory is offline Offline
Newbie Poster

Can anyone help me with this problem in C?

 
-1
  #1
Sep 3rd, 2009
Instructions
Zululand has a congress with in theory 97 seats. These are apportioned among the three
states Alpha, Bravo and Charlie in proportion to their population. To be precise, each state
receives its share rounded down to the nearest whole number, even if this means the total is
less than 97. Write a C program to compute the seats as follows:
1. Prompt the user for the population of Alpha, then of Bravo, and then of Charlie.
2. Calculate the total population of Zululand.
3. Calculate the percentages for each state.
4. Calculate the number of seats for each state.
5. Print out the results in a suitable format.
Sample Run
(In preparing the handout, I converted user input to italics)
Enter population of Alpha: 123
Enter population of Bravo: 234
Enter population of Charlie: 345
Total population is 702
Alpha has 17.52% of the population and 16 seats
Bravo has 33.33% of the population and 32 seats
Charlie has 49.15% of the population and 47 seats
Total seats allocated is 95
Last edited by uniquevictory; Sep 3rd, 2009 at 3:11 pm.
Quick reply to this message  
Join Date: Feb 2008
Posts: 1,602
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: Can anyone help me with this problem in C?

 
2
  #2
Sep 3rd, 2009
hi, that's a very nice cut-and-paste you've done.

did you use the mouse right-click to paste? or did you use CTRL-C and CTRL-V? i prefer using the keyboard myself, it seems much more efficient.
Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Can anyone help me with this problem in C?

 
0
  #3
Sep 4th, 2009
And you've posted a duplicate here: http://www.daniweb.com/forums/thread216071.html
"Technological progress is like an axe in the hands of a pathological criminal."
Quick reply to this message  
Closed Thread

Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC