fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n ; cin>>n;
  7. for(int i=1;i<=n;i++){
  8. int digit = (2*(i-1)+1) % 10;
  9. for(int j =1;j<=n-i+1;j++){
  10. cout<<digit;
  11. digit = (digit + 2)%10;
  12.  
  13. }
  14. digit=1;
  15. for(int j =1 ;j<=i-1;j++){
  16. cout<<digit;
  17. digit = (digit + 2)%10;
  18. }
  19. cout<<endl;
  20.  
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5324KB
stdin
4
stdout
1357
3571
5713
7135