Respuesta :
Answer:
The program and output are attached below
Explanation:
Code to copy:-
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
const int FLATS = 50;
double rent, raise, maintenance, profit = 0, p;
int n, vacantFlats = 0;
cout <<"Enter rent to occupy all the units : ";
cin >> rent;
cout << "\nEnter increase in rent : ";
cin >> raise;
cout<<"\nEnter amount to maintain a rented unit : ";
cin >> maintenance;
// calculate profit
while ( ( FLATS - vacantFlats ) > 0 )
{
p = (FLATS - vacantFlats) * (rent - maintenance);
if ( p > profit )
{
profit = p;
n = ( FLATS - vacantFlats );
}
rent += raise;
vacantFlats++;
}
cout << "\nNumber of units to be rented to "<< "maximize the profit = " << n <<"\n";
system("PAUSE");
return 0;
}

