From 94483a15405416005550684b666c378caee49b39 Mon Sep 17 00:00:00 2001 From: Kennedy Menezes Date: Tue, 7 Sep 2021 14:56:42 -0300 Subject: [PATCH] if para scanf --- 2020/01/função_retorna.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/2020/01/função_retorna.c b/2020/01/função_retorna.c index cd94ab7..4fdcb83 100644 --- a/2020/01/função_retorna.c +++ b/2020/01/função_retorna.c @@ -1,24 +1,14 @@ int funcaoBalancear () { int n; - float litro, teor; + float litro1, teor1, litro1, teor2; printf("Quantos barris você quer balancear?"); scanf("%d", &n); - for(int i=0; i <= n; i++) { - scanf("%f %f", &litro, &teor); - - switch () - { - case: - break; - default: - break; - } - } - - + if(!(scanf("%f %f %f %f", &litro1, &teor1, &litro2, &teor2)) || + (litro1 || teor1 || litro2 || teor2) <= 0) return 0; + } int main () {