Find N integers with given difference between product and sum | CPP code to generate numbers with difference between product and sum is D ; Function to implement calculation ; Driver code
#include <iostream> NEW_LINE using namespace std ; void findNumbers ( int n , int d ) { for ( int i = 0 ; i < n - 2 ; i ++ ) cout << "1" << " ▁ " ; cout << "2" << " ▁ " ; cout << n + d << endl ; } int main ( ) { int N = 3 , D = 5 ; findNumbers ( N , D ) ; return 0 ; }