#include
using namespace std;
int main()
{
int num, x, remainder, midrow, column, used, halfcolumn, secondhalf;
cout << "Enter number of students: "; //get number of students
cin >> num;
if(num % 4 == 0) //if number of students is a multiple of 4
{
x = num / 4; //solve for x
cout << "Number of students used is " << num << endl;
cout << "Number of balance students is 0\n\n"; //All students are used to form the E in this case
}
else //if number of students is not a multiple of 4
{
remainder = num % 4; //finds number of remaining students after forming the E
x = num / 4;
used = 4*x; //finds number of students used to form the E
cout << "Number of students used is " << used << endl;
cout << "Number of balance students is " << remainder << endl << endl;
}
midrow = x-1; //number of students for middle row of E
column = x+1; //number of students for column of E
if(column%2 == 1)//gets half the number of students used for the column of E when there's an odd number of students there
{
halfcolumn = (column/2) + 1;
secondhalf = column/2;
}
if(column%2 == 0)//gets half the number of students used for the column of E when there's an even number of students there
{
halfcolumn = (column/2);
secondhalf = column/2;
}
for(int i=0; i