Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- float A, B;
- char op;
- printf("veillez entrer A et B : ");
- scanf("%f %f", &A, &B);
- printf("\nveillez selectionner un des operateurs suivants :\n");
- printf("'+' addition\n");
- printf("'-' soustraction\n");
- printf("'*' multiplication\n");
- printf("'/' devision\n\n");
- printf("votre selection : ");
- scanf(" %c", &op);
- switch(op) {
- case '+': printf(" %.2f + %.2f = %.2f", A, B, A+B); break;
- case '-': printf(" %.2f - %.2f = %.2f", A, B, A-B); break;
- case '*': printf(" %.2f * %.2f = %.2f", A, B, A*B); break;
- case '/': if(B != 0) {printf(" %.2f / %.2f = %.2f", A, B, A/B); break;} else printf("devision sur 0 est impossible."); break;
- default: printf("operateur incorrecte");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement