clanguage07@gmail.com

clanguage07@gmail.com

Saturday, June 16, 2012

arthametic operator

#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();
  }

No comments:

Post a Comment

GET MORE INFORMATION

http://ads.qadservice.com/t?id=c2168e05-8974-4816-872a-91936ff7379d&size=1024x768&drct=true