Advertisement
STANAANDREY

gen_mat

May 6th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  int a[100][100],n,m,i,j;
  7.  
  8.  cout<<"n=";cin>>n;
  9.  cout<<"m=";cin>>m;
  10.  
  11.  for (i=0;i<n;i++)
  12.     for (j=0;j<m;j++)
  13.      a[i][j]=(i<j)?i:j;
  14.  
  15.  for (i=0;i<n;i++)    {
  16.  for (j=0;j<m;j++)
  17. cout<<a[i][j]<<' ';
  18. cout<<endl;
  19.  }
  20.     return 0;//
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement