renomeando função e adicionando if's

This commit is contained in:
Kennedy Menezes 2021-09-07 15:08:20 -03:00
parent 94483a1540
commit 0789cbf76e
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
int funcaoBalancear () { int funcaoRetorna () {
int n; int n;
float litro1, teor1, litro1, teor2; float litro1, teor1, litro1, teor2;
@ -7,12 +7,14 @@ int funcaoBalancear () {
scanf("%d", &n); scanf("%d", &n);
if(!(scanf("%f %f %f %f", &litro1, &teor1, &litro2, &teor2)) || if(!(scanf("%f %f %f %f", &litro1, &teor1, &litro2, &teor2)) ||
(litro1 || teor1 || litro2 || teor2) <= 0) return 0; (litro1 || teor1 || litro2 || teor2) <= 0) return 0; //Se o teor for negativo ou scanf for lido incorretamente
if((teor1 || teor2) > 1) return 1; // Se o teor for maior que 100%
} }
int main () { int main () {
funcaoBalancear(); funcaoRetorna();
} }