| | |
Can anyone help me with this problem in C?
![]() |
•
•
Join Date: Sep 2009
Posts: 2
Reputation:
Solved Threads: 0
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
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.
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."
![]() |
Similar Threads
- Problem with Windows Update and WinXP (Web Browsers)
- Installing Windows 98 On VMware. Floppy problem (Windows 95 / 98 / Me)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- Redhat Linux 6.2 - ipop3d problem? (*nix Software)
- Problem with T720 (Cellphones, PDAs and Handheld Devices)
- Connection Problems (Networking Hardware Configuration)
- Encoding (Unicode) problem in IE 6.0 (Web Browsers)
- .htaccess mod_rewrite problem (Linux Servers and Apache)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
Other Threads in the C Forum
- Previous Thread: Had a homework problem in c programming and need help!!
- Next Thread: sizeof operator
| Thread Tools | Search this Thread |
#include adobe ansi api array asterisks binarysearch changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic execv feet fgets file fork forloop frequency function getlasterror givemetehcodez global grade graphics gtkgcurlcompiling hacking hardware highest histogram i/o include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue mysql number odf opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf segmentationfault sequential shape socket socketprograming standard string systemcall threads turboc unix user voidmain() wab windows.h windowsapi





