Printing Pattern Using Loops

Sort by

recency

|

1066 Discussions

|

  • + 0 comments

    When exploring different printing patterns using loops, it's important to also consider the cost efficiency per page. Optimizing loop structures not only affects the visual output but can also reduce the amount of ink or toner used, minimizing waste. Thoughtful planning of patterns, such as limiting unnecessary repetitions or adjusting spacing, can lead to cleaner prints and more economical use of resources without compromising the intended design.

  • + 0 comments

    The structured symmetry of this pattern reminds me of how camberley airport cars maintain balance and precision in their routes, ensuring smooth coordination just like these neatly aligned numbers.

  • + 0 comments
    int main() 
    {
        int n;
        int absRow, absColumn;
        scanf("%d", &n);
        
        for(int row = n; row >= -n; row--)
        {
            if(row == 0 || row == -1)
            {
                continue;
            }
            for(int column = n; column >= -n; column--)
            {
                if(column == 0 || column == -1)
                {
                    continue;
                }
                absRow = abs(row);
                absColumn = abs(column);
                if(absColumn <= absRow)
                {
                    printf("%d ", absRow);
                }
                else
                {
                    printf("%d ", absColumn);
                }
            }
            printf("\n");
        }
       
        return 0;
    }
    
  • + 0 comments

    input n is difficult

  • + 0 comments

    my background is not CS! so I was stuck, bruteforcing this problem for a week until I asked the right questions and this popped up! https://www.geeksforgeeks.org/machine-learning/chebyshev-distance/