{"id":12213,"date":"2021-09-30T15:30:05","date_gmt":"2021-09-30T10:00:05","guid":{"rendered":"https:\/\/python-programs.com\/?p=12213"},"modified":"2021-11-22T18:34:26","modified_gmt":"2021-11-22T13:04:26","slug":"python-program-to-print-square-pattern-with-numbers","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-print-square-pattern-with-numbers\/","title":{"rendered":"Python Program to Print Square Pattern with Numbers"},"content":{"rendered":"

The best and excellent way to learn a java programming language is by practicing Simple Java Program Examples<\/a> as it includes basic to advanced levels of concepts.<\/p>\n

Given the number of rows, the task is to print Square Pattern with Numbers in C, C++, and Python<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given number of rows = 9<\/pre>\n

Output:<\/strong><\/p>\n

1 2 3 4 5 6 7 8 9 \r\n2 2 3 4 5 6 7 8 9 \r\n3 3 3 4 5 6 7 8 9 \r\n4 4 4 4 5 6 7 8 9 \r\n5 5 5 5 5 6 7 8 9 \r\n6 6 6 6 6 6 7 8 9 \r\n7 7 7 7 7 7 7 8 9 \r\n8 8 8 8 8 8 8 8 9 \r\n9 9 9 9 9 9 9 9 9<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given number of rows = 6<\/pre>\n

Output:<\/strong><\/p>\n

1 2 3 4 5 6 \r\n2 2 3 4 5 6 \r\n3 3 3 4 5 6 \r\n4 4 4 4 5 6 \r\n5 5 5 5 5 6 \r\n6 6 6 6 6 6<\/pre>\n

Program to Print Square Pattern with Numbers in C, C++, and Python<\/h2>\n

Below are the ways to print Square Pattern with Numbers in C, C++, and Python<\/p>\n