Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- int i,j,matriks1[10][10],matriks2[10][10],x,y;
- printf("matriks 1\n");
- printf("Masukan jumlah baris : "); scanf("%d",&x);
- printf("Masukan jumlah kolom : "); scanf("%d",&y);
- for (i=0; i<x; i++)
- {
- for (j=0; j<y; j++)
- {
- printf("elemen ke -[%d][%d]: ",i,j); scanf("%d",&matriks1[i][j]);
- }
- }
- printf("\nmatriks 1\n");
- for (i=0; i<x; i++)
- {
- for (j=0; j<y; j++)
- printf("%3d",matriks1[i][j]);
- printf("\n");
- }
- printf("matriks 2\n");
- printf("Masukan jumlah baris : %d\n",x);
- printf("Masukan jumlah kolom : %d\n",y);
- for (i=0; i<x; i++)
- {
- for (j=0; j<y; j++)
- {
- printf("elemen ke -[%d][%d]: ",i,j); scanf("%d",&matriks2[i][j]);
- }
- }
- printf("\nmatriks 2\n");
- for (i=0; i<x; i++)
- {
- for (j=0; j<y; j++)
- printf("%3d",matriks2[i][j]);
- printf("\n");
- }
- printf("\nHasil penjumlahan\n");
- for (i=0; i<x; i++)
- {
- for (j=0; j<y; j++)
- printf("%3d",matriks1[i][j]+matriks2[i][j]);
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement