Advertisement
STANAANDREY

9bac 41

Jan 21st, 2019
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7.  unsigned k,i;
  8.  
  9.  cout<<"k=";cin>>k;
  10.  for (i=1;i<=9;i++)
  11.  {
  12.      if (i-k>=0)
  13.         cout<<i<<i-k<<i<<i-k<<i<<" ";
  14.       if (i-2*k>=0&&i-k>=0)
  15.      cout<<i<<i-k<<i-2*k<<i-k<<i<<" ";
  16.      if (i+k<=9)
  17.      cout<<i<<i+k<<i<<i+k<<i<<" ";
  18.      if (i+2*k<=9&&i+k<=9)
  19.      cout<<i<<i+k<<i+2*k<<i+k<<i<<" ";
  20.  
  21.  }
  22.  
  23.  return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement