Skip to main content

Write a program which add, subtract, multiply, divide and modulo two numbers with all possible data types.



1.
Write a program which add, subtract, multiply, divide and modulo two numbers with all possible data types.



#include<stdio.h>
#include<conio.h>
void main()
{
          int a,b,c;
          char ope;
          clrscr();
          printf("Enter Any two numbers=");
          scanf("%d%d",&a,&b);
          flushall();
          printf("Enter The Operation You Want To Perform(+,-,*,/,%)=");
          scanf("%c",&ope);
          if(ope=='+')
          c=a+b;
          else if(ope=='-')
          c=a-b;
          else if(ope=='*')
          c=a*b;
          else if(ope=='/')
          c=a/b;
          else if(ope=='%')
          c=a%b;
          printf("The Answer Of The Operation '%c' is =%d",ope,c);


getch();
}



Comments