GriefNorth

Lr5

Nov 5th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int m[4][5], d[4][5];
  6. int i,j;
  7. int c;
  8. cout << "введите 4 строки по 5 чисел" << endl;
  9. for (i=0;i<4;i++)
  10. for (j=0;j<5;j++)
  11. cin >> m[i][j];
  12.  
  13. cout << "Матрица M:\n";
  14. for (i=0;i<4;i++)
  15. {
  16. for (j=0;j<5;j++)
  17. cout << m[i][j] << " ";
  18. cout << "\n";
  19. }
  20.  
  21. cout << "Введите константу C: " << endl;
  22. cin >> c;
  23.  
  24. for (i=0;i<4;i++)
  25. for (j=0;j<5;j++)
  26. d[i][j]=m[i][j]*c;
  27.  
  28.  
  29. cout << "Матрица D:\n";
  30. for (i=0;i<4;i++)
  31. {
  32. for (j=0;j<5;j++)
  33. cout << d[i][j] << " ";
  34. cout << "\n";
  35. }
  36.  
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment