If 4

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

#include <stdio.

h>

#include <conio.h>

main()

int k=0;

float x=0,y=0,z=0;

//clrscr();

printf("Enter two numbers:");

scanf("%f%f",&x,&y);

printf("\n Enter your choice:\n");

printf("Press 1 for addition\n");

printf("Press 2 for subtraction\n");

printf("Press 3 for multiplication\n");

printf("Press 4 for division\n");

scanf("%d",&k);

if (k==1)

z=x+y;

printf("Result=%f",z);

else if(k==2)

z=x-y;
printf("Result=%f",z);

else if (k==3)

z=x*y;

printf("Result=%f",z);

else if (k==4)

z=x/y;

printf("Result=%f",z);

else

printf("You pressed a wrong key");

getch();

return 0;

You might also like