0
How can I change the result of scanf into other number?
Hi I'm studying C. If a score below 0.0 is entered by scanf, I want to make it to be forced to change to 0.0. How can I code this?
1 Antwort
+ 2
int main() {
float var;
float score=0;
scanf("%f",&var);
if(var<score){
var=score;
printf("%1.1f",var);
}
return 0;
}