1. 326.
    0
    /*valid input which should be between 10 and 20*/

    2. include <stdio.h>

    int main(void)
    {
    int min = 10, max =20, mid;
    char skip;
    int error, status;
    do{
    error= 0;
    printf("nEnter an int between %d and %dn",min,max);
    status = scanf("%d", &mid); //Status is number of variables that read by scanf
    //for this time it should be 1
    //check if it is 1 or not, if not, it is error
    if(status != 1)
    {
    eror = 1;
    scanf("%c",&skip);
    printf("ninvalid %cnskipping rest of the line... ", skip);
    }
    //check if it is in the range [10 - 20]
    else if (mid < min || mid > max)
    {
    error = 1;
    printf("nNumber %d is not in rangen", mid);
    }
    /*if user enters wrong values or
    more than enough values compile will skip
    these valuesby this small do-while loop*/
    do {
    scanf("%c",&skip);
    printf(" %c ", skip);
    }while(skip != 'n');
    /*if you don't add this loop compiler consider all
    entered values as inputs. this loop can be thought as sweeper*/
    }while(error); //as long as there is error try to get new value from user.

    printf("nmid value is %dnn",mid);

    return 0;
    }

    vize var aq çalışmaktan başım ağrıyo
    ···
   tümünü göster