{"id":12279,"date":"2021-09-30T15:00:05","date_gmt":"2021-09-30T09:30:05","guid":{"rendered":"https:\/\/python-programs.com\/?p=12279"},"modified":"2021-11-22T18:34:30","modified_gmt":"2021-11-22T13:04:30","slug":"python-program-to-print-alternate-numbers-pattern-using-while-loop","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-print-alternate-numbers-pattern-using-while-loop\/","title":{"rendered":"Python Program to Print Alternate Numbers Pattern using While Loop"},"content":{"rendered":"

Interested in programming and want to excel in it by choosing the short ways. Then, practicing with the available Java Program list<\/a> is mandatory.<\/p>\n

Given the number of rows, the task is to Print Alternate Numbers Pattern using While Loop 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 \r\n3 3 \r\n5 5 5 \r\n7 7 7 7 \r\n9 9 9 9 9 \r\n11 11 11 11 11 11 \r\n13 13 13 13 13 13 13 \r\n15 15 15 15 15 15 15 15 \r\n17 17 17 17 17 17 17 17 17<\/pre>\n

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

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

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

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

1 \r\n3 3 \r\n5 5 5 \r\n7 7 7 7 \r\n9 9 9 9 9 \r\n11 11 11 11 11 11 \r\n13 13 13 13 13 13 13<\/pre>\n

Program to Print Alternate Numbers Pattern using While Loop in C, C++, and Python<\/h2>\n

Below are the ways to Print Alternate Numbers Pattern using While Loop in C, C++, and Python<\/p>\n