BxComp/2020/01/função_retorna.c

20 lines
460 B
C
Raw Normal View History

2021-09-07 20:08:20 +02:00
int funcaoRetorna () {
2021-09-07 19:33:10 +02:00
int n;
2021-09-07 19:56:42 +02:00
float litro1, teor1, litro1, teor2;
2021-09-07 19:33:10 +02:00
printf("Quantos barris você quer balancear?");
scanf("%d", &n);
2021-09-07 19:56:42 +02:00
if(!(scanf("%f %f %f %f", &litro1, &teor1, &litro2, &teor2)) ||
2021-09-07 20:08:20 +02:00
(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%
2021-09-07 19:56:42 +02:00
2021-09-07 19:41:19 +02:00
}
int main () {
2021-09-07 20:08:20 +02:00
funcaoRetorna();
2021-09-07 19:33:10 +02:00
}