Check for possibility
if ( ans_pair . first == - 1 ) { Console . Write ( " Not ▁ possible " ) ; return ; } double a1 = ans_pair . first ; double a2 = ans_pair . second ; double r = a2 / a1 ; Console . Write ( " The ▁ resultant ▁ sequence ▁ is : STRNEWLINE " ) ; for ( int i = 1 ; i <= n ; i ++ ) { int ai = ( int ) ( a1 * Math . Pow ( r , i - 1 ) ) ; Console . Write ( ai + " ▁ " ) ; } }