Write a program for A.P Series in java ?
package javatute; import java.util.Scanner; public class APSeries { public static void main(String[] args) { int n = 1, p; Scanner s = new Scanner(System.in); System.out.println("Enter first element of A.P"); int a = s.nextInt(); System.out.println("Enter difference"); int d = s.nextInt(); System.out.println("Enter the number of terms for you want A.P"); int b = s.nextInt(); while (b != n - 1) { p = (a + (n - 1) * d); n++; System.out.print(p + " "); } } }