Features Menu Jupyter Notebook
My features for the team menu
import java.util.Scanner;
public class GCD {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the two numbers: ");
int a = input.nextInt();
int b = input.nextInt();
System.out.println("The two numbers are: " + a + " and " + b);
System.out.println("The GCD of two numbers is: " + gcd(a, b));
}
// Eucid algorithm
public static int gcd(int a,int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
}
GCD.main(null)
import java.util.Scanner;
public class LCM {
public static void main(String[] args) {
(Scanner input = new Scanner(System.in);
System.out.println("Enter the two numbers: ");
)
int a = input.nextInt();
int b = input.nextInt();
System.out.println("The two numbers are: " + a + " and " + b);
System.out.println("The LCM of two numbers is: " + lcm(a, b));
}
public static int gcd(int a,int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
public static int lcm(int a,int b)
{
return a*b/(gcd(a,b));
}
}
LCM.main(null)
class GFG {
// Function to print the fibonacci series
static int fibonacci(int n)
{
// Base Case
if (n <= 1)
return n;
// Recursive call
return fibonacci(n - 1)
+ fibonacci(n - 2);
}
// Driver Code
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
System.out.println("Enter a number: ");
int N = input.nextInt();
System.out.println("The number is: " + N);
for (int i = 0; i < N; i++) {
System.out.print(fibonacci(i) + " ");
}
}
}
GFG.main(null)