Matriz 5x5

  • November 2019
  • 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 Matriz 5x5 as PDF for free.

More details

  • Words: 146
  • Pages: 2
/*--------------------------------------------------------------------------Programa en donde se ingresan numeros a una matriz de 5X5. * Calcula el numero mayor. * Calcula el numero menor. * Sumar la matriz ---------------------------------------------------------------------------*/ #include<stdio.h> #include #include<string.h> //--------------------------------------------------------------------------void ingreso(int f,int c,float mat[5][5]) { for(f=0;f<5;f++) { for(c=0;c<5;c++) { printf("Ingrese numero para la fila %d, columna %d:",f,c); scanf("%f",&mat[f][c]); } } } //--------------------------------------------------------------------------float numero_mayor(int f,int c,float mat[5][5]) { float num_mayor=0; for(f=0;f<5;f++) { for(c=0;c<5;c++) { if(mat[f][c]>num_mayor) num_mayor=mat[f][c]; } } return(num_mayor); } //--------------------------------------------------------------------------float numero_menor(int f,int c,float mat[5][5],float num_menor) { for(f=0;f<5;f++) { for(c=0;c<5;c++) { if(num_menor>mat[f][c]) num_menor=mat[f][c]; } } return(num_menor); } //---------------------------------------------------------------------------

float suma_mat(int f,int c,float mat[5][5]) { float suma1=0; for(f=0;f<5;f++) { for(c=0;c<5;c++) { suma1=suma1+mat[f][c]; } } return(suma1); } //--------------------------------------------------------------------------void main() { clrscr(); float matriz1[5][5]={{0,0},{0,0}}; float mayor,menor,suma; int i,j; mayor=menor=suma=i=j=0; ingreso(i,j,matriz1); mayor=numero_mayor(i,j,matriz1); menor=numero_menor(i,j,matriz1,mayor); suma=suma_mat(i,j,matriz1); printf("\n\nResultado de la Matriz:\n\n"); for(i=0;i<5;i++) { for(j=0;j<5;j++) { printf("%5.1f ",matriz1[i][j]); } if(j==5) printf("\n"); } printf("\nEl numero mayor es:%5.2f",mayor); printf("\nEl numero menor es:%5.2f",menor); printf("\nLa suma es:%5.2f",suma); getche(); }

Related Documents

Matriz 5x5
November 2019 5
Matriz
November 2019 59
Matriz
October 2019 55
Matriz
October 2019 47
Matriz
June 2020 16
Matriz
June 2020 19