Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int add (int x, int y)
- {
- int result;
- result= x+y;
- printf("Result : %d\n", result);
- }
- int sub (int a, int b)
- {
- int result;
- result= a-b;
- printf("Result : %d\n", result);
- }
- float mult (float e, float f)
- {
- float result;
- result= (e*f);
- printf("Result : %f\n",result);
- }
- float div (float j, float k)
- {
- float result;
- if(k==0)
- {
- printf("Not Possible \n");
- }
- else
- {
- result= (j/k);
- printf("Result : %f\n", result);
- }
- }
- int main()
- {
- printf("(1) Addition\n");
- printf("(2) Subtraction\n");
- printf("(3) Multiplication \n");
- printf("(4) Division\n");
- printf("(5) Delete\n");
- int choice;
- printf("Enter Your choice: \n");
- scanf("%d", &choice);
- switch(choice){
- case 1:
- printf("For Addition \n");
- int x, y;
- printf("Enter your numbers: \n");
- scanf("%d %d", &x, &y);
- add(x,y);
- break;
- case 2:
- printf("For Subtraction\n");
- int a, b;
- printf("Enter your numbers: \n");
- scanf("%d %d", &a, &b);
- sub(a,b);
- break;
- case 3:
- printf("Fot Multiplication \n");
- float e, f;
- printf("Enter your numbers: \n");
- scanf("%f %f", &e, &f);
- mult(e,f);
- break;
- case 4:
- printf("For Division\n");
- float j, k;
- printf("Enter your numbers: \n");
- scanf("%f %f", &j, &k);
- div(j,k);
- break;
- case 5:
- printf("You Have deleted your program\n");
- break;
- default:
- printf("wrong input");
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement