Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. { int a,b,c,d;
  6.  
  7. printf("DODAWANIE MACIERZY\n\n");
  8. printf("Podaj liczbe wierszy macierzy:");
  9. scanf("%d",&a);
  10. printf("Podaj liczbe kolumn macierzy:");
  11. scanf("%d",&b);
  12.  
  13. int W[a][b];
  14. int K[a][b];
  15. int I[a][b];
  16. printf("\nWpisz element pierwszej macierzy\n\n");
  17.  
  18. for(c=0;c<a;c++){
  19. for(d=0;d<b;d++)
  20. {printf("Podaj element:"); scanf("%d",&W[c][d]);}
  21.  
  22. }
  23. printf("\nMacierz :\n");
  24. for(c=0;c<a;c++){printf("\n");
  25. for(d=0;d<b;d++)
  26. {printf("%d",W[c][d]);}
  27.  
  28.  
  29. }
  30.  
  31. printf("\n\nWpisz element drugiej macierzy\n\n");
  32. for(c=0;c<a;c++){
  33. for(d=0;d<b;d++)
  34. {printf("Podaj element:"); scanf("%d",&K[c][d]);}
  35.  
  36. }
  37. printf("\nMacierz :\n");
  38. for(c=0;c<a;c++){printf("\n");
  39. for(d=0;d<b;d++)
  40. {printf("%d",K[c][d]);}
  41.  
  42.  
  43. }
  44. printf("\nSuma macierzy :\n");
  45. for(c=0;c<a;c++){printf("\n");
  46. for(d=0;d<b;d++){printf("%d",I[c][d]=W[c][d]+K[c][d]);}
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement