#include<stdio.h> #include<conio.h> int main(){ int a,b,opt; printf("For sum press : 1 \n For sub press : 2 \n For mul press : 3 \n For div press : 4 \n"); printf("Plz., choose a option to perform any mathematcal operaton: "); again: scanf("%d",&opt); switch (opt) { case 1: printf("Enter your first no. : "); scanf("%d",&a); printf("Enter your second no. : "); scanf("%d",&b); printf("The sum of %d and %d is %d",a,b,(a+b)); break; case 2: printf("Enter your first no. : "); scanf("%d",&a); printf("Enter your second no. : "); scanf("%d",&b); printf("The sum of %d and %d is %d",a,b,(a-b)); break; case 3: printf("Enter your first no. : "); scanf("%d",&a); printf("Enter your second no. : "); scanf("%d",&b); printf("The mul of %d and %d is %d",a,b,(a*b)); break; case 4: printf("Enter your first no. : "); scanf("%d",&a); printf("Enter your second no. : "); scanf("%d",&b); printf("The div of %d and %d is %d",a,b,(a/b)); break; default: printf("Plz., choose a valid option... \n"); goto again; break; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter