Advertisement
alfars215

برنامج لطباعة أرقام بشكل محدد

Dec 7th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int i,j,n,k;
  6.     cout<<"insert n"<<endl;
  7.     cin>>n;
  8.  
  9.     for(i=1;i<=n;i++) {
  10.         k=i;
  11.         for(j=1;j<=n;j++){
  12.             if(k==n+1)
  13.             k=1;
  14.             cout<<k<<" ";
  15.             k+=1;
  16.         }
  17.         cout<<endl;
  18.     }
  19.  
  20. }
  21.  
  22. //-------output----------
  23. /*
  24. insert n
  25. 6
  26. 1 2 3 4 5 6
  27. 2 3 4 5 6 1
  28. 3 4 5 6 1 2
  29. 4 5 6 1 2 3
  30. 5 6 1 2 3 4
  31. 6 1 2 3 4 5
  32. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement