4. Program
4. How to Print this series ? 6, 10, 18, 34, 54, 82....N
import java.util.Scanner; class Series { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter the range greater then 0 : "); int n = sc.nextInt(); int i = 6, j=1; if(n>0) { while(i <= n) { if(j%3!=0) { System.out.print(i + " "); i = i+4*j; } j++; } } else { System.out.print("Enter the range greater then 0 : "); } } }