0
My problem is the next one I’m creating loop while
which cannot receive values less than or equal to zero, and would also declare that it cannot receive empty values for the program force the user to enter a number and not the 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 it accepts no data on the console, in case it wanted the system to accept only if a number was typed on the console.
You need to explain better, preferably what code you’re having trouble with. Null is one thing, empty is another, depends on the type of data you’re dealing with. Null is 0, but the
scanf()
does not deal with anything that can be null. So the question has wrong premises and is confused, needs to specify better so we can help.– Maniero
I made the change.
– Andre Spindola
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site
– Maniero