Sum number series



package exam;

public class Program1 {
 public static void main(String[] args) {
  int n=5;
  for(int i=1;i<=n;i++) {
   System.out.print(" " +(2*i));
  }
 }

}


o/p:-
 2 4 6 8 10