Advertisement
Guest User

ex c

a guest
Sep 28th, 2015
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. int main(){
  3. float a,b;
  4. int choix;
  5. printf("taper deux nombres: a b ");
  6. scanf("%f",&a);
  7. scanf("%f",&b);
  8. printf("Menu des operations\n 1.Addition\n 2.Soustraction\n 3.Multiplication\n 4.Division\n");
  9. scanf("%d", &choix);
  10. switch(choix){
  11.     case 1 : printf("choix: Addition\n");
  12. printf("%f+%f=%f\n",a,b,a+b);
  13. break;
  14.     case 2 : printf("choix: Soustraction\n");
  15. printf("%f-%f=%f\n",a,b,a-b);
  16. break;
  17.     case 3 : printf("choix: Multiplication\n");
  18. printf("%f×%f=%f\n",a,b,a*b);
  19. break;
  20.     case 4 : printf("choix: Division\n");
  21. printf("%f/%f=%f\n",a,b,a/b);
  22. break;
  23.     default : printf("Pas un choix valide");
  24. break;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement