Program to Create Geometric Sequence in java

Program to Create Geometric Sequence in java programming language by using user Input. import java.util.Scanner; class Sequence { public static void main(String args[]) { int n=5; //limit int r=2; //common ratio int a=2; //terms int sum=0; //sum of the series Scanner sc=new Scanner(System.in);//take input from user System.out.print(“Enter a first term:”); Read more…

Write a Program To find Factorial of a number

Write a Program To find Factorial of a number ,By taking user input value in java import java.util.Scanner; class Factorial { public static void main(String args[]) { int n,fact=1; Scanner sc=new Scanner(System.in); System.out.print(“Enter the number:”); n=sc.nextInt(); for(int i=1;i<=n;i++) { fact=fact*i; } System.out.print(“Factorial of” +n+ “is” +fact); } } READ MORE