Advertisement
SelinD

125

May 16th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int a,b,c,k;
  6. cin>>k;
  7. for(a=1; a<=9; a++)
  8. {
  9. b=a-k;
  10. if(b>=0)
  11. {
  12. c=b-k;
  13. if(c>=0)
  14. {
  15. cout<<a<<b<<c<<b<<a<<" ";
  16. cout<<endl;
  17. }
  18. c=b+k;
  19. if(c<=9)
  20. {
  21. cout<<a<<b<<c<<b<<a<<" ";
  22. cout<<endl;
  23. }
  24. }
  25. b=a+k;
  26. if(b<=9)
  27. {
  28. c=b-k;
  29. if(c>=0)
  30. {
  31. cout<<a<<b<<c<<b<<a<<" ";
  32. cout<<endl;
  33. }
  34. c=b+k;
  35. if(c<=9)
  36. {
  37. cout<<a<<b<<c<<b<<a<<" ";
  38. cout<<endl;
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement