Computer Science, asked by XxzapsiaxX, 7 months ago

II. Rewrite using switch case :
1. #include<stdio.h>
void main()
{
int a;
printf("Enter course code:(1-2)');
scanf("%d", &a);
if ( a== 1)
{puts("Mechatronics");
printf("Duration = 8 months");}
else if(a= =2)
{puts("Robotics");
printf("Duration = 3 months"); }
else
printf("Code not available");
} in C programmjng​

Answers

Answered by sonalverma34
1

Answer:

#include <stdio.h>

void main()

{

int a;

printf(" Enter course code:(1-2)") ;

scanf("%d",&a);

Switch(a)

{ case 1:"Duration =8 months";

break;

case 2:"Duration =3 months " ;

break;

default:"code not available" ;

}

}

Explanation:

You can also run the above code by using this or you can also use the subject names in case of 1 and 2.

Similar questions