My problem is the following I am creating a loop while
that can not receive values smaller than or equal to zero, and would like to also declare that it can not receive empty values for the program to force the user to enter a number and not enter with no field in scanf()
.
printf("Digite o valor da posicao X:");
scanf("%d",&x);
//faz a verificação se o numero é 0 ou < 0
while (x <= 0){
printf("0 ou < 0 nao forma um triangulo por favor digite novamente a medida X\n");
scanf("%d",&x);
}
When the user just type enter he accepts without any data on the console, in case he wanted the system to accept only if a number was entered on the console.