mercredi 6 septembre 2017

Check two conditions in If Statement not working in c [duplicate]

This question already has an answer here:

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h> 
#include <stdbool.h>

int main() {
    int a,b;
    scanf("%d %d",&a,&b);
    if(1<=a<=4 && 1<=b<=9) {
        printf("%d %d",a,b);
    }
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    return 0;
}

Whenever i give a=2 and b=11 as input. Condition inside if is still working. But it should not work as b is out of range.

Aucun commentaire:

Enregistrer un commentaire