pastebin

Paste Search Dynamic
Recent pastes
choice
  1. #include <stdio.h>
  2. const float PI = 3.141;
  3. int main()
  4. {
  5.     int a,b,choice;
  6.  
  7.     char print[3][40] = {
  8.     {"Enter a Value : "},
  9.     {"Enter b Value : "},
  10.     {"Now choose the number between 1 to 5 : "}};
  11.  
  12.     printf("%s", print[0]);
  13.     scanf("%d", &a);
  14.  
  15.     printf("%s", print[1]);
  16.     scanf("%d", &b);
  17.  
  18.     printf("%s", print[2]);
  19.     scanf("%d", &choice);
  20.  
  21.     if(choice == 1)
  22.     printf("You chosen : 1. nAddition = %d", a+b);
  23.     else if(choice == 2)
  24.     printf("You chosen : 2. nSubstraction = %d", a-b);
  25.     else if(choice == 3)
  26.     printf("You chosen : 3. nMultiplication = %d", a*b);
  27.     else if(choice == 4)
  28.     printf("You chosen : 4. nDivision = %f ", (float) a/b);
  29.     else if(choice == 5)
  30.     printf("You chosen : 5. nModulus = %d", a%b);
  31.     else
  32.     printf("Invalid Number. nPleace, choose the number between 1 to 5 only!n");
  33.  
  34.     return 0;
  35. }
Parsed in 0.015 seconds