#include <stdio.h>

// Programma test appartenza a intervallo chiuso [a,b]

int main() { // inizia qui
    
    int i;
    int a, b; // estremi intervallo
    int t; // condzione app. a intervallo

    a = 3; // valore estremi intervallo
    b = 7;
    
    i = 0; // verifico per valori da 1 a 10
    while ( i <= 10 ) { 
        // devo decidere se i app. a [a,b] 
        // metto il valore bool in t
        t = (i >= a) && (i <= b);
        printf("%d",i);      
        if( !t ) {
            printf(" non");
        }
        printf(" è compreso in [%d,%d]\n", a,b);
        i = i + 1;
    }

} // finisce qui

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: