Session 8
}
switch(op) { case ‘+’: res = num1 printf(“\n break; case ‘-’: res = num1 printf(“\n break; case ‘/’: res = num1 printf(“\n break; case ‘*’: res = num1 printf(“\n break; default: printf(“\n break; } return 0;
Lab Guide
Condition (Lab)
+ num2; The Sum is: %d”, res); – num2; Number after Subtraction: %d”, res); / num2; Number after Division: %d”, res); * num2; Number after multiplication: %d”, res); Invalid”);
3. Build and run the application. OUTPUT : Number after subtraction: 57
Elementary Programming with C
Version 1.1 © Aptech Limited
page 135 of 356