943,875 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 517
  • C RSS
Sep 3rd, 2009
-1

Can anyone help me with this problem in C?

Expand Post »
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.
Similar Threads
Reputation Points: 9
Solved Threads: 0
Newbie Poster
uniquevictory is offline Offline
2 posts
since Sep 2009
Sep 3rd, 2009
2

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

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.
Reputation Points: 2143
Solved Threads: 178
Posting Maven
jephthah is offline Offline
2,567 posts
since Feb 2008
Sep 4th, 2009
1

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

And you've posted a duplicate here: http://www.daniweb.com/forums/thread216071.html
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in C Forum Timeline: Had a homework problem in c programming and need help!!
Next Thread in C Forum Timeline: sizeof operator





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC