Made a Java program for making an A.P

I was recently promoted to tenth (not the one writing the board of course). I got bored and because I'm a computer student I made this program.

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("enter n,a,d"); int n=sc.nextInt(); int a=sc.nextInt(); int d= sc.nextInt(); int i; for(i=1;i<=n;i++){ a=a+d; System.out.print(" "+a);

}

} }

Try it out for yourselves!