Question
#include int main() { clrscr(); int floors = 6, rooms = 20, suites = 120, occupied = 0, totalRooms = 120, totalOccupied = 0, totalUnoccupied = 0, numFloors=16; int occupRate; //store hotel occupancy rate for (int floor = 10; floor <= numFloors; floor++) //initiate loop { if (floor==13) { floor=14; } scanf("Enter the number of rooms occupied on " << floor << "floor. "); printf occupied; while(occupied>20 | occupied<0) { scanf("Invalid Entry "); scanf("Enter the number of rooms occupied on " << floor << "floor. "); printf occupied; } totalOccupied += occupied; //number of rooms in each floor will be added to totalRooms totalUnoccupied = totalRooms - totalOccupied; //store total of unoccupied rooms in hotel } occupRate=(totalOccupied*100)/totalRoo
Explanation / Answer
#include #include int main() { clrscr(); int floors = 6, rooms = 20, suites = 120, occupied = 0, totalRooms = 120, totalOccupied = 0, totalUnoccupied = 0, numFloors=16; int occupRate; //store hotel occupancy rate for (int floor = 10; floor