series
series
series
Scanner;
public class Fibonacci_Series
{
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.print("Enter the number of terms in Fibonacci:");
int count = s.nextInt();
int first_term=0;
int second_term=1;
for(int i = 1; i <= count; i++)
{
System.out.print(first_term + " ");
int next_term = first_term + second_term;
first_term = second_term;
second_term = next_term;
}
}
}
***************************************************************
import java.util.Scanner;
public class Palindrome_Number
{
public static void main(String args[])
{
int num,rem,temp,reverse = 0;
Scanner s = new Scanner(System.in);
System.out.print("Enter the number:");
num = s.nextInt();
temp=num;
while(num != 0)
{
rem = num % 10;
reverse = reverse * 10 + rem;
num = num / 10;
}
if(temp==reverse)
System.out.println("Given number is a Palindrome :"+reverse);
else
System.out.println("Given number is not a Palindrome");
}
}
____________________________________________________________________
*****************************************************
import java.util.Scanner;
public class Multiplication_Table
{
public static void main(String[] args)
{
int min,max,i,j;
Scanner s = new Scanner(System.in);
System.out.print("Enter the min number:");
min=s.nextInt();
System.out.print("Enter the max number:");
max=s.nextInt();
for(int i=min; i <= max; i++)
{
for(int j=1; j <= 10; j++)
{
System.out.println("\n %d * %d = %d \n", i, j, i * j);
}
System.out.println("\n -------------------------");
}
}
}
*************************************************************************
import java.util.Scanner;
public class Equal_Integer{
import java.util.Scanner;
public class MatixMultiplication
{
public static void main(String args[])
{
int n;
Scanner input = new Scanner(System.in);
System.out.println("Enter the base of squared matrices");
n = input.nextInt();
int[][] a = new int[n][n];
int[][] b = new int[n][n];
int[][] c = new int[n][n];
System.out.println("Enter the elements of 1st martix row wise \n");
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
a[i][j] = input.nextInt();
}
}
System.out.println("Enter the elements of 2nd martix row wise \n");
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
b[i][j] = input.nextInt();
}
}
System.out.println("Multiplying the matrices...");
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
for (int k = 0; k < n; k++)
{
c[i][j] = c[i][j] + a[i][k] * b[k][j];
}
}
}
System.out.println("The product is:");
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
System.out.print(c[i][j] + " ");
}
System.out.println();
}
input.close();
}
}
***********************
import java.util.Scanner;
**********************************************************************
import java.util.Scanner;
************************************************