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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| #include <stdio.h>
#include <stdlib.h>
int main()
{
long choix , nombre1 , nombre2 , resultat;
printf("--Menu--\n\n");
printf("1.Addition\n");
printf("2.Soustraction\n");
printf("3.Multiplication\n");
printf("4.Division\n");
printf("Choississez un nombre");
scanf("%ld" , &choix);
if(choix==1)
{
printf("nombre1:");
scanf("%ld" , &nombre1);
printf("nombre2:");
scanf("%ld" , &nombre2);
resultat = nombre1 + nombre2;
printf("\n\n%ld+%ld=%ld" , nombre1 , nombre2 , resultat);
}
else if(choix==2)
{
printf("nombre1:");
scanf("%ld" , &nombre1);
printf("nombre2:");
scanf("%ld" , &nombre2);
resultat = nombre1 - nombre2;
printf("\n\n%ld-%ld=%ld" , nombre1 , nombre2 , resultat);
}
else if(choix==3)
{
printf("nombre1:");
scanf("%ld" , &nombre1);
printf("nombre2:");
scanf("%ld" , &nombre2);
resultat = nombre1 * nombre2;
printf("\n\n%ld*%ld=%ld" , nombre1 , nombre2 , resultat);
}
else
{
printf("nombre1:");
scanf("%ld" , &nombre1);
printf("nombre2:");
scanf("%ld" , &nombre2);
resultat = nombre1 / nombre2;
printf("\n\n%ld/%ld=%ld" , nombre1 , nombre2 , resultat);
getchar;
system("pause");
}
} |
Partager