Math, asked by gkGeetakumari7373, 1 year ago

There are 3 labs in the cse department(l1, l2 and l3) with a seating capacity of x, y and z. One of the 3 labs has been allocated for ace training. Out of the available labs, find the lab which has the minimal seating capacity. Input and output format: assume that x, y and z are always distinct. Refer sample input and output.

Answers

Answered by Anonymous
6

Answer:

Step-by-step explanation:

Assume that x, y, and z will be always distinct.  (Input-Output format)

Sample Input and Output 1:

Enter x

30  (output)

Enter y

40   (output)

Enter z

20   (output)

Enter the lab allocated for the training

L3   (output)

L1 has the minimal seating capacity

Program Code:

#include<stdio.h>

#include<string.h>

int main()

{

int x,y,z;

char lab[2];

printf("Enter x\n");

scanf("%d", &x);

printf("Enter y\n");

scanf("%d", &y);

printf("Enter z\n");

scanf("%d", &z);

printf("Enter the lab allocated for the training\n");

scanf("%s",lab);

{

       if(y<z)

        printf("L2 has the minimal seating capacity");

        else

        printf("L3 has the minimal seating capacity");  

   }

   else if(strcmp(lab, "L2")==0)  

   {

       if(x<z)

        printf("L1 has the minimal seating capacity");

        else

        printf("L3 has the minimal seating capacity");  

   }

   else

   {

       if(x<y)

        printf("L1 has the minimal seating capacity");

        else

        printf("L2 has the minimal seating capacity");    

   }

   return 0;

}

Similar questions