Increasing sequence with given GCD | Java implementation of the approach ; Function to print the required sequence ; Driver Code
class GFG { static void generateSequence ( int n , int g ) { for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( i * g + " ▁ " ) ; ; } public static void main ( String [ ] args ) { int n = 6 , g = 5 ; generateSequence ( n , g ) ; } }