{"id":10853,"date":"2021-09-30T14:30:32","date_gmt":"2021-09-30T09:00:32","guid":{"rendered":"https:\/\/python-programs.com\/?p=10853"},"modified":"2021-11-22T18:34:31","modified_gmt":"2021-11-22T13:04:31","slug":"python-program-to-print-1-and-0-in-alternative-columns","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-print-1-and-0-in-alternative-columns\/","title":{"rendered":"Python Program to Print 1 and 0 in Alternative Columns"},"content":{"rendered":"

Want to excel in java coding? Practice with these Java Programs examples with output<\/a> and write any kind of easy or difficult programs in the java language<\/p>\n

Given the number of rows and columns, the task is to print 1 and 0 in alternative columns in C, C++, and Python.<\/p>\n

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

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

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

given number of rows =4\r\ngiven number of columns=3<\/pre>\n

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

1 0 1 \r\n1 0 1 \r\n1 0 1 \r\n1 0 1<\/pre>\n

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

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

given number of rows =7\r\ngiven number of columns=15<\/pre>\n

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

1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 \r\n1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 \r\n1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 \r\n1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 \r\n1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 \r\n1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 \r\n1 0 1 0 1 0 1 0 1 0 1 0 1 0 1<\/pre>\n

Program to Print 1 and 0 in alternative Columns in C, C++, and Python<\/h2>\n

Below are the ways to print 1 and 0 in alternative columns in C, C++, and Python.<\/p>\n