Sequence of Even Series
Write a program to Print series of even numbers upto desired sequence.
import java.util.Scanner;
class EvenSeries
{
public static void main()
{
System.out.println("Enter the number upto which you want the Sequence");
Scanner in = new Scanner(System.in);
int x = in.nextInt();
for(int i=1;i<x;i++)
System.out.print((2*i-2)+", ");
System.out.print((2*x-2)+". ");
}
}
For Any Desired Program comment below. WE WILL TRY OUR BEST TO MAKE THAT PROGRAM AVAILABLE.
Comments
Post a Comment