Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void show(int array[][40],int a)
- {
- int i,j;
- for(i=0;i<a;i++)
- {
- for(j=0;j<a;j++)
- {
- if(i==j)
- {
- array[i][i]=0;
- }
- }
- }
- for(i=0;i<a;i++)
- {
- for(j=0;j<a;j++)
- {
- cout<<array[i][j]<<" ";
- }
- cout<<"\n";
- }
- }
- int main()
- {
- int r,arr[40][40],i,j;
- cout<<"Enter rows and columns : ";
- cin>>r;
- for(i=0;i<r;i++)
- {
- for(j=0;j<r;j++)
- {
- arr[i][j]=j+1;
- }
- }
- show(arr,r);
- return 0;
- }
Add Comment
Please, Sign In to add comment