Pessoal estou tentando escrever um codigo para medir temperatura e cheguei a isso aqui:
int main(void){
int high;
int low;
int i;
for (i = 0; i < NUMS; ++i) {
do{
printf("Enter the high value for day %d: \n", i+1);
scanf("%d", &high);
printf("Enter the low value for day %d: \n", i+1);
scanf("%d", &low);
if ((high > 40) || (low < -40) || (high < low)){
printf ("Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.\n");
}
} while((high > 40) || (low < -40) || (high < low));
}
return 0;
}
Mas percebi que to repetindo a linha do If e While. Como melhorar isso?