Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int numar;
  7. cout<<"Introduceti un numar mai mic sau egal cu 8 = ";cin>>numar;
  8. if(!(numar > 0 && numar <= 8)){
  9. return 0;
  10. }
  11. int matrice[numar][numar];
  12.  
  13. for(int i = 0; i < numar; i++){
  14. for(int j = 0; j < numar; j++){
  15. cout<<"M["<<i+1<<"]["<<j+1<<"]=";cin>>matrice[i][j];
  16. cout<<'\n';
  17. }
  18. }
  19.  
  20. for(int i = 0; i < numar; i++){
  21. for(int j = 0; j < numar; j++){
  22. cout<<matrice[i][j]<<" ";
  23. }
  24. cout<<'\n';
  25. }
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement