Saturday, February 14, 2009

CS121 exer3

Photobucket
#include#include
void main(){ clrscr(); int choice,a,b,n,y,sum=0,sub=0,mul=0,div=0;
printf("W E L C O M E ! ! !"); printf("\nSelect operation you like to Try!"); printf("\n\t[A] for ADDITION"); printf("\n\t[B] for SUBTRACTION"); printf("\n\t[C] for MULTIPLICATION"); printf("\n\t[D] for DIVISION"); printf("\n\t[E] for Exit"); printf("\nEnter your choice operation here:"); scanf("%s",&choice);switch(choice){ case 'A': printf("Enter number:"); scanf("%d",&a); printf("Enter another number:"); scanf("%d",&b); sum=a+b; printf("Sum of two number is: %d",sum); break;
case 'B': printf("Enter number:"); scanf("%d",&a); printf("Enter another number:"); scanf("%d",&b); sub=a-b; printf("Sub of two number is: %d",sub); break;
case 'C': printf("Enter number:"); scanf("%d",&a); printf("Enter another number:"); scanf("%d",&b); mul=a*b; printf("Mul of two number is: %d",mul); break;
case 'D': printf("Enter number:"); scanf("%d",&a); printf("Enter another number:"); scanf("%d",&b); div=a/b; printf("Div of two number is: %d",div); break;
case'E': printf("\n\nEnd of the program,\nThank you very much!!!! ");
}printfgetch(); }

No comments:

Post a Comment