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
   |  
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    // Declaration des variables
    long nbr1, nbr2 ;
    char oper[5];
 
    printf("Ce programme va nous permettre de tester des conditions\n");
 
    printf("Entrez un nombre a : ");
    scanf("%ld", &nbr1);
    printf("\nEntrez un nombre b: ");
    scanf("%ld", &nbr2);
 
    printf("\n\nQue voules vous faire ?");
    scanf("%s", &oper);
    printf("\n%s", oper);
 
    // Test des conditions
    if (oper == "plus")
    {
        printf("Vous avez choisi l'addition.\n");
        printf("%ld + %ld = %ld", nbr1, nbr2, nbr1+nbr2);
    }
    else
    {
        printf("Il y a un problème");
    }
 
    system("PAUSE");
    return 0;
} | 
Partager