text: Print N lines of 4 numbers such that every pair among 4 numbers has a GCD K | C ++ implementation of the above approach ; Function to print N lines ; Iterate N times to print N lines ; Driver Code
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; void printLines ( int n , int k ) { for ( int i = 0 ; i < n ; i ++ ) { cout << k * ( 6 * i + 1 ) << " ▁ " << k * ( 6 * i + 2 ) << " ▁ " << k * ( 6 * i + 3 ) << " ▁ " << k * ( 6 * i + 5 ) << endl ; } } int main ( ) { int n = 2 , k = 2 ; printLines ( n , k ) ; return 0 ; }