Ex14-areasuperior.txt

  • Uploaded by: Gustavo Sousa
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ex14-areasuperior.txt as PDF for free.

More details

  • Words: 104
  • Pages: 1
#include <stdio.h> #define TAM_MATRIZ 12 int main(void) { char acao; double matriz[TAM_MATRIZ][TAM_MATRIZ]; int col, linha; double soma = 0; int n = 0; scanf("%c", &acao); // Lê uma linha à linha for (linha = 0; linha < TAM_MATRIZ; linha++) { for (col = 0; col < TAM_MATRIZ; col++) { scanf("%lf", &matriz[linha][col]); } } // Percorre cada linha da parte superior [0 - 4] for (linha = 1; linha <= 5; linha++) { for (col = linha; col < TAM_MATRIZ - linha; col++) { soma += matriz[linha - 1][col]; n++; } } printf("%.1lf\n", acao == 'S' ? soma : soma / n); return 0; }

More Documents from "Gustavo Sousa"

Ex4-cedulas.txt
May 2020 7
November 2019 9
Ex3-bhaskara.txt
May 2020 12