Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C Compiler.
- Code, Compile, Run and Debug C program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <stdio.h>
- int main()
- {
- int matriceA[100][100], matriceB[100][100],matriceRez[100][100];
- int i,j,totalSum=0,n,m;
- printf("Numarul de linii:\n");
- scanf("%d", &n);
- printf("Numarul de coloane:\n");
- scanf("%d", &m);
- printf("matriceA:\n");
- for(i=0;i<n;i++)
- {
- for(j=0;j<m;j++)
- {
- printf("introduceti valoare pentru pozitiile: %d %d \n", i,j);
- scanf("%d", &matriceA[i][j]);
- }
- }
- printf("matriceB:\n");
- for(i=0;i<n;i++)
- {
- for(j=0;j<m;j++)
- {
- printf("introduceti valoare pentru pozitiile: %d %d \n", i,j);
- scanf("%d", &matriceB[i][j]);
- }
- }
- for(i=0;i<n;i++)
- {
- for(j=0;j<m;j++)
- {
- matriceRez[i][j] = matriceA[i][j] + matriceB[i][j];
- totalSum += matriceRez[i][j];
- }
- }
- printf("Matrice rezultat \n");
- for(i=0;i<n;i++)
- {
- for(j=0;j<m;j++)
- {
- printf("%d ", matriceRez[i][j]);
- }
- printf("\n");
- }
- printf("Suma totala: %d", totalSum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement