-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
29 lines (24 loc) · 686 Bytes
/
Copy pathmain.c
File metadata and controls
29 lines (24 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <stdlib.h>
void main()
{
float nb, nb2;
int choix;
printf("Entrer le premier nombre: ");
scanf("%f", &nb);
printf("Entrer le Second nombre: ");
scanf("%f", &nb2);
printf("Faites un choix d'operation: \n 1- Somme \n 2- Produit \n 3- Division \n 4- Moyenne \n");
scanf("%d", &choix);
if (choix == 1){
printf("La somme est: %f", nb + nb2);
}else if (choix == 2) {
printf("Le produit est: %f", nb * nb2);
}else if (choix == 3) {
printf("La division donne: %f", nb / nb2);
}else if (choix == 4) {
printf("La moyenne est: %f", (nb + nb2) / 2);
}else{
printf("Erreur de choix");
}
}