Sum of Arithmetic and Geometric Sequence
Sum of Arithmetic Sequence The java program generates arithmetic sequence of K numbers with common difference d. The user has to give some input integer value to generate the sequence of numbers while running the program. These inputs are stored into variables a ,d and K. a - represents sequence first item d - sequence items common difference and K - number of items in the sequence. Arithmetic sequence = sum of sequence import java.util.Scanner; public class Sumarsequence { public static void main(String[] args) { System.out.println( "Sum of Arithmetic Sequence \n" ); Scanner sc = new Scanner(System.in); System.out.println( "first value in sequence" ); int a = sc.nextInt(); System.out.println( "common deference of sequence" ); int d = sc.nextInt(); System.out.println( "K number of items in the sequence" ); int K = sc.nextInt(); sc.close(); ...