#include<stdio.h>
#include<conio.h>
void main()
{
char op;
int a,b,c;
clrscr();
printf("Enter an arthametic operator:");
scanf("%c",&op);
printf("\n Enter two operands:");
scanf("%d%d",&a,&b);
switch(op)
{
case'+':
printf("\naddition of two number %2d %2d is:%d",a,b,a+b);
break;
case'-':
printf("\nsubstraction of two numbers %2d %2d is:%d",a,b,a-b);
break;
case'*':
printf("\nmultiplication of two numbers %2d%2d is:%d",a,b,a*b);
break;
case'/':
printf("\ndivision(quotient)of two numbers %2d%2d is:%d",a,b,a/b);
break;
case'%':
printf("\nmodulo operation(remainder)of two numbers %2d%2d is:%d",a,b,a%b);
break;
default:
printf("\n please enter correct operator");
break;
}
getch();
}
#include<conio.h>
void main()
{
char op;
int a,b,c;
clrscr();
printf("Enter an arthametic operator:");
scanf("%c",&op);
printf("\n Enter two operands:");
scanf("%d%d",&a,&b);
switch(op)
{
case'+':
printf("\naddition of two number %2d %2d is:%d",a,b,a+b);
break;
case'-':
printf("\nsubstraction of two numbers %2d %2d is:%d",a,b,a-b);
break;
case'*':
printf("\nmultiplication of two numbers %2d%2d is:%d",a,b,a*b);
break;
case'/':
printf("\ndivision(quotient)of two numbers %2d%2d is:%d",a,b,a/b);
break;
case'%':
printf("\nmodulo operation(remainder)of two numbers %2d%2d is:%d",a,b,a%b);
break;
default:
printf("\n please enter correct operator");
break;
}
getch();
}
No comments:
Post a Comment