Skip to content

Instantly share code, notes, and snippets.

@joffilyfe
Created January 19, 2015 01:28
Show Gist options
  • Save joffilyfe/b2ce54e2734746d4bcca to your computer and use it in GitHub Desktop.
Save joffilyfe/b2ce54e2734746d4bcca to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void) {
int i, j, linha;
float entrada, sum;
char operacao;
scanf("%d", &linha);
getchar();
scanf("%c", &operacao);
getchar();
for (i = 0; i < 12; i++) {
for (j = 0; j < 12; j++) {
scanf("%f", &entrada);
if (j == linha) {
sum += entrada;
}
}
}
if (operacao == 'S') {
printf("%0.1f\n", sum);
} else {
printf("%0.1f\n", sum / 12);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment