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

this is what i got done...need someone to look over it and need some help.

#include<stdio.h>
int main()
{
int Alpha = 123;
int Bravo = 234;
int Charlie = 345;
int seats = 97;
printf("Alpha+Bravo+Charlie");
scanf("%d", & Alpha);
scanf("%d", & Bravo);
scanf("%d", & Charlie);

i think i did the three steps..please help

i saw the same homework the other article.
i've done this code but i can't show you all of them.
i can just tell and give you some hints to solve this problem...
to be honest, this problem is too easy. it just requires you how to calculate. that's it. don't use integer type. it's not gonna divide below zero, use float type and FLOOR function is useful when you get least(?) number. if you make any code, i will help you more ;) cheerup

This article has been dead for over six months. Start a new discussion instead.