Advertisement
Guest User

Lily && Milon

a guest
Sep 23rd, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.98 KB | None | 0 0
  1. #include<stdio.h>
  2.  #include<conio.h>
  3.   main ()
  4.  {
  5.      /* n1 for 1st number
  6.      n2 for 2nd number
  7.      r for result
  8.      x for your opretion ( that is mean what you want to do?)
  9.      o for opson ( that is mean do you want it again?) */
  10.      printf ("Welcome to Milan's calculator\n");
  11.      char o;
  12.      do{
  13.      double n1,n2,r;
  14.      printf( "Input your Number\n");
  15.      scanf("%lf %lf",&n1,&n2);
  16.      printf("Input Your opratino \n");
  17.      char x;
  18.      scanf(" %c", &x);
  19.  
  20.      if (x == '+')
  21.      {
  22.      r = n1 + n2;
  23.      }
  24.      else if (x == '-' )
  25.      {
  26.      r=n1 - n2;
  27.      }
  28.      else if (x == '*')
  29.      {
  30.      r = n1 * n2;
  31.      }
  32.      else if (x =='/')
  33.      {
  34.          r =n1 /n2 ;
  35.      }
  36.      else
  37.      {
  38.          printf(" You give wrong input\n");
  39.      }
  40.  
  41.      printf(" Our result is %lf\n",r);
  42.      printf(" \n do you want to continue y/n?\n");
  43.      o =getch ();
  44.      }while(o =='y');
  45.      printf(" END\n");
  46.      getch ();
  47.      return 0;
  48.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement