Advertisement
jamius19

Untitled

Feb 10th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. int main() {
  5.     int a, b, c;
  6.     char d;
  7.  
  8.     printf("Enter the first integer\n");
  9.     scanf("%d", &a);
  10.     printf("Enter the second integer\n");
  11.     scanf("%d", &b);
  12.     fflush(stdin);
  13.     printf("Enter the sign\n");
  14.     scanf("%c", &d);
  15.  
  16.  
  17.     if(d=='+') {
  18.             c=a+b;
  19.             printf("result is %d", c);
  20.             }
  21.     else if(d=='-') {
  22.             c=a-b;
  23.             printf("result is %d", c);
  24.             }
  25.     else if(d=='*') {
  26.             c=a*b;
  27.             printf("result is %d", c);
  28.  
  29.             }
  30.     else if(d=='/') {
  31.             c=a/b;
  32.             printf("result is %d", c);
  33.  
  34.             }
  35.     else {
  36.  
  37.             printf("Try again");
  38.             }
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement