Find two numbers with difference and division both same as N | C ++ program for the above approach ; Function to find two numbers with difference and division both as N ; Condition if the answer is not possible ; Calculate a and b ; Print the values ; Driver Code ; Given N ; Function Call
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findAandB ( double N ) { if ( N == 1 ) { cout << " No " ; return ; } double a = N * N / ( N - 1 ) ; double b = a / N ; cout << " a ▁ = ▁ " << a << endl ; cout << " b ▁ = ▁ " << b << endl ; } int main ( ) { double N = 6 ; findAandB ( N ) ; return 0 ; }