fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int m,n,a=0;
  6. cout<<"Enter the no. of rows and coulomn in a matrix\n";
  7. cin>>m>>n;
  8. int arr[m][n];
  9. cout<<"Enter the elements of the array\n";
  10. for(int i=0;i<m;i++){
  11. for(int j=0;j<n;j++)
  12. cin>>arr[i][j];
  13. }
  14. for(int i=0;i<(m-1);i++){
  15. for(int j=0;j<(n-1);j++){
  16. a=arr[i][j];
  17. if(arr[i+1][j+1]!=a){
  18. cout<<"False\n";
  19. return 0;
  20. }
  21. }
  22. }
  23.  
  24. cout<<"True\n";
  25. return 0;
  26. }
Success #stdin #stdout 0s 5536KB
stdin
2 2
1 1
1 3
stdout
Enter the no. of rows and coulomn in a matrix
Enter the elements of the array
False