Thursday, February 12, 2009

Exer 3


#include
#include


void main()
{

clrscr();
int letter,a,b,n,y,sum=0,sub=0,mul=0,div=0;

gotoxy(30,4);textcolor(GREEN);cprintf("W E L C O M E ! ! !");
gotoxy(26,6);textcolor(GREEN);cprintf("\nSelect operation you like to Try!");
gotoxy(25,8);textcolor(GREEN+BLINK);cprintf("\n\tA.] ADD");
gotoxy(25,9);textcolor(GREEN);cprintf("\n\tB.] SUB");
gotoxy(25,10);textcolor(GREEN);cprintf("\n\tC.] PRODUCT");
gotoxy(25,11);textcolor(GREEN);cprintf("\n\tD.] QUIENT");
gotoxy(25,12);textcolor(GREEN);cprintf("\n\tE.] Exit");
gotoxy(25,14);textcolor(CYAN);cprintf("\nPlease choose from the following:");
scanf("%s",&letter);

switch(letter)
{
case 'A':
gotoxy(25,16);cprintf("Enter first number:");
scanf("%d",&a);
gotoxy(25,17);cprintf("Enter second number:");
scanf("%d",&b);
sum=a+b;
gotoxy(25,18);cprintf("Sum of two number is: %d",sum);

break;
}
switch(letter)
{
case 'B':
gotoxy(25,16);textcolor(YELLOW);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,17);textcolor(RED);cprintf("Enter another number:");
scanf("%d",&b);
sub=a-b;
gotoxy(25,18);textcolor(YGREEN+BLINK);cprintf("Difference of two numbe is: %d",sub);

break;
}
switch(letter)
{
case 'C':
gotoxy(25,16);textcolor(VIOLET);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,17);textcolor(RED);cprintf("Enter another number:");
scanf("%d",&b);
mul=a*b;
gotoxy(25,18);textcolor(ORANGE+BLINK);cprintf("Product of two numbe is: %d",mul);

break;
}
switch(letter)
{
case 'D':
gotoxy(25,16);textcolor(BLUE);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,17);textcolor(YELLOW);cprintf("Enter another number:");
scanf("%d",&b);
div=a/b;
gotoxy(25,18);textcolor(GREEN+BLINK);cprintf("Qoutient of two numbe is: %d",div);

break;
}
switch(letter)
{
case'E':
gotoxy(25,18);textcolor(RED);cprintf("\n\nEnd of program,.. Thank you!");
}
getch();
}

No comments:

Post a Comment