Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int i,j,n,k;
- cout<<"insert n"<<endl;
- cin>>n;
- for(i=1;i<=n;i++) {
- k=i;
- for(j=1;j<=n;j++){
- if(k==n+1)
- k=1;
- cout<<k<<" ";
- k+=1;
- }
- cout<<endl;
- }
- }
- //-------output----------
- /*
- insert n
- 6
- 1 2 3 4 5 6
- 2 3 4 5 6 1
- 3 4 5 6 1 2
- 4 5 6 1 2 3
- 5 6 1 2 3 4
- 6 1 2 3 4 5
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement