Program to Find Arithmetic Series in java Programming by taking user input

Program of Arithmetic Series

import java.util.Scanner;
 class ArithmeticSeries 
     public static void main(String args[])
 int n=6;  //limit
int d=3;   //common diffrence
 int a=2;   //terms

Scanner sc=new Scanner(;

 System.out.print("Enter first no of a:");


 System.out.print("Enter the difference of d:"); 
 System.out.print("Enter the Limit value of n:"); n=sc.nextInt();

 for(int i=1;i<=n;i++)
    a=a+d;   //adding diffrence with term

Enter first no of a:9
 Enter the difference of d:2
 Enter the Limit value of n:3
 9 11 13
 Process completed.*/

Leave a Reply