You are on page 1of 1

#include<stdio.

h>
#include<conio.h>
#include<math.h>
void main()
{
int a,b,c,e;
clrscr();
do
{
read:
printf("\n\n\n------------Menu-----------\n");
/*Opening Menu*/
printf("1- for Subtract two integer\n");
printf("2- for Compare two Integer to find the Smallest\n");
printf("3- for Testing an Integer for Odd or Even\n");
printf("4- for Quit\n");
printf("\n------------Menu-----------\n\n\n");
printf("Enter your choice :");
/*User Choice Entry*/
scanf("%d",&e);
switch (e)
{
case 1:
/*Option 1: Subtract 2 integers*/
printf("Enter the Two Numbers :");
scanf("%d%d",&a,&b);
c=a-b;
printf("Subtraction of the two numbers is = %d",c);
break ;
case 2:
/*Option 2: Compare 2 integers*/
printf("Enter the Two Numbers :");
scanf("%d%d",&a,&b);
if(a>b)
printf("%d is smallest among the two integers.",b);
else
printf("%d is smallest among the two integers.",a);
break ;
case 3:
printf("Enter a Number :");
scanf("%d",&a);
if(a%2==0)
printf("The number is Even.");
else
printf("The number is Odd.");
break ;

/*Option 3: Test an integer*/

case 4:
break ;

/*Option 4: Exit*/

default :
printf("\nSorry!! Wrong Choice.\n");
goto read;
}
}
while (e!=0 && e!=4);
getch();
}

/*Re-Display Original Menu*/

You might also like