Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int i, j;
- double matriz[12][12], soma = 0, contador = 0;
- char opcao;
- scanf("%c", &opcao);
- if(opcao == 'S')
- {
- for(i = 0; i < 12; i++)
- {
- for(j = 0; j < 12; j++)
- {
- scanf("%lf", &matriz[i][j]);
- if(i < j && j < 12 - 1 - i && i <= 4)
- {
- soma += matriz[i][j];
- }
- }
- }
- printf("%.1f\n", soma);
- }
- if(opcao == 'M')
- {
- for(i = 0; i < 12; i++)
- {
- for(j = 0; j < 12; j++)
- {
- scanf("%lf", &matriz[i][j]);
- if(i < j && j < 12 - 1 - i && i <= 4)
- {
- soma += matriz[i][j];
- contador++;
- }
- }
- }
- printf("%.1f\n", soma/contador);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement