Function to print all the elements of the Arithmetic Progression
public static void print_array ( int [ ] ans , int N ) { for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( ans [ i ] + " ▁ " ) ; } }