Write a program that input number of students and determine smallest classroom that can accomodate those students.
A sample run :
Enter number of students: 79
Classroom: B

Recommended Answers

All 2 Replies

here you go

#include<iostream.h>
#include<conio.h>
int main()
{
int c;
cout<<"Enter number of students:";
cin>>c;
if(c>100)
{
         cout<<"No class available";
         }
         

         else if(c>80)
         {
              cout<<"Class room A";
              }
               else if(c>75)
         {
              cout<<"Class room B";
              }
               else if(c>45)
         {
              cout<<"Class room c";
              }
               else if(c>25)
         {
              cout<<"Class room D";
              }
                else if(c>0)
         {
              cout<<"Class room E";
              }
              
         getch();
         }

Thanks!;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.