Skip to content

Instantly share code, notes, and snippets.

@joffilyfe
Created January 18, 2015 14:47
Show Gist options
  • Save joffilyfe/87fc93b05c45b1bb8ff1 to your computer and use it in GitHub Desktop.
Save joffilyfe/87fc93b05c45b1bb8ff1 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void) {
int i, pergunta, combustivel[] = {0, 0, 0};
pergunta = 0;
do {
if (pergunta >= 1 && pergunta <= 3) {
combustivel[pergunta-1] += 1;
}
scanf("%d", &pergunta);
} while (pergunta != 4);
printf("MUITO OBRIGADO\n");
printf("Alcool: %d\n", combustivel[0]);
printf("Gasolina: %d\n", combustivel[1]);
printf("Diesel: %d\n", combustivel[2]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment