Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #define NR 10
  4.  
  5. int main()
  6. {
  7.     int a[NR][NR],b[NR][NR];
  8.     int i,j,n;
  9.  
  10.     do
  11.     {
  12.         printf("Introduceti numaru de elemente care le va avea matricea.\n");
  13.         scanf("%d",&n);
  14.     } while(n>NR);
  15.  
  16.  
  17.     printf("Introduceti valorile matricei a.\n");
  18.  
  19.     for(i=0;i<n;i++)
  20.         for(j=0;j<n;j++)
  21.             scanf("%d",&a[i][j]);
  22.  
  23.     printf("\n");
  24.  
  25.  
  26.     printf("Introduceti valorile matricei b.\b");
  27.  
  28.  
  29.     for(i=0;i<n;i++)
  30.         for (j=0;j<n;j++)
  31.             scanf("%d",&b[i][j]);
  32.  
  33.  
  34.  
  35.     int c[NR][NR];
  36.  
  37.     for (i=0;i<n;i++)
  38.     {
  39.         for (j=0;j<n;j++)
  40.         {
  41.             c[i][j]=a[i][j]+b[i][j];
  42.             printf("%5d \n",c[i][j]);
  43.         }  
  44.     }
  45.  
  46.     getchar();
  47.    
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement