Question: #include int main() { int num; //ask user ti enter number printf(Enter a number: ); scanf(%d,&num); //display car part from array corresponding to number else
#include
int main()
{
int num;
//ask user ti enter number
printf("Enter a number: ");
scanf("%d",&num);
//display car part from array corresponding to number else display invalid number
switch(num)
{
case 1:
printf("Engine");
break;
case 2:
printf("Cylinder head");
break;
case 3:
printf("Spark plug");
break;
case 4:
printf("Injections");
break;
case 5:
printf("Transmission gear");
break;
case 6:
printf("Alternator");
break;
case 7:
printf("Arms");
break;
case 8:
printf("Shock absorbs");
break;
case 9:
printf("Brakes");
break;
case 10:
printf("Battery");
break;
case 11:
printf("Spare wheel");
break;
case 12:
printf("Distributor");
break;
case 13:
printf("Brake fluid reservoir");
break;
case 14:
printf("Exhaust pipe");
break;
case 15:
printf("Wheel nuts");
break;
case 16:
printf("Oil filter");
break;
case 17:
printf("Accelerator");
break;
case 18:
printf("Radiator");
break;
case 19:
printf("Tyre");
break;
case 20:
printf("Fan");
break;
case 21:
printf("Driveshaft");
break;
case 22:
printf("Bumper");
break;
case 23:
printf("Fuse box");
break;
case 24:
printf("Dipstick");
break;
case25:
printf("Chassis");
break;
case 26:
printf("Ignition");
break;
case 27:
printf("Dipstick");
break;
case 28:
printf("Roof rack");
break;
case 29:
printf("Body work");
break;
case 30:
printf("Gearbox");
break;
default:
printf("Invalid number!");
}
return 0;
}
I need here to explain to me the code that I use in this program cause the Dr he will ask me why u use this and this and what it's Jon so plz in simply way give me the explanation that I will tell him tomorrow
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
