Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- unsigned k,i;
- cout<<"k=";cin>>k;
- for (i=1;i<=9;i++)
- {
- if (i-k>=0)
- cout<<i<<i-k<<i<<i-k<<i<<" ";
- if (i-2*k>=0&&i-k>=0)
- cout<<i<<i-k<<i-2*k<<i-k<<i<<" ";
- if (i+k<=9)
- cout<<i<<i+k<<i<<i+k<<i<<" ";
- if (i+2*k<=9&&i+k<=9)
- cout<<i<<i+k<<i+2*k<<i+k<<i<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement