lunes, 19 de agosto de 2013

Suma de Matrices

#include<stdio.h>

main(){
   
    system ("Title Programa2.c");
   
    printf("***********************************************\n");
    printf("Pide valores de dos matrices e imprime la suma \n");
    printf("************************************************");
    getch ();
    system("cls");
   
    int matriz1[3][3],matriz2[3][3],matriz3[3][3],x,y;
    for(x=0; x<=2; x++)
        for(y=0; y<=2; y++){
       
        printf("Dame el valor del elemento %i %i de la matriz\n",x,y);
        scanf("%i",&matriz1 [x][y]);   
        }
        system("cls");
       
    for(x=0; x<=2; x++)
        for(y=0; y<=2; y++){
       
        printf("Dame el valor del elemento %i %i de la matriz\n",x,y);
        scanf("%i",&matriz2 [x][y]);
        }
        system("cls");
       
       
        for(x=0; x<=2; x++)
            for(y=0; y<=2; y++)
            printf("\nEl valor de la matriz %i %i es: %i \n",x,y,matriz3[x][y] = matriz1[x][y] + matriz2[x][y]);
       
    system("PAUSE");
    getch ();
}

No hay comentarios:

Publicar un comentario