Advertisement
salmancreation

Function and Swicth Case Class

Jun 25th, 2015
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.81 KB | None | 0 0
  1. #include<stdio.h>
  2.     int x=5,y=5,add,divide,sub;
  3.  
  4.     int addsum()
  5.     {
  6.         add = x+y;
  7.         return add;
  8.     }
  9.     int diviesum()
  10.     {
  11.         divide = x/y;
  12.         return divide;
  13.     }
  14.     int subsum()
  15.     {
  16.         sub = x-y;
  17.         return sub;
  18.     }
  19.     int main()
  20.     {
  21.     int fun;
  22.         printf("Hello User Enter 1 For Add or 2 Divie or Sub\n");
  23.         scanf("%d",&fun);
  24.         switch(fun)
  25.         {
  26.             case 1:
  27.             printf("Your Add Is = %d\n",addsum());
  28.             break;
  29.             case 2:
  30.             printf("Your Add Is = %d\n",diviesum());
  31.             break;
  32.             case 3:
  33.             printf("Your Add Is = %d\n",subsum());
  34.             break;
  35.             default :
  36.             printf(" Your Input Is Wrong !");
  37.         }
  38.         return 0;
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement