Code Below:


import java.util.*;
public class menudriven
{
    public static void s()
    {
        Scanner s=new Scanner(System.in);
        System.out.println("1-Smaller of 2 nos.");
        System.out.println("2-Larger of 2 nos.");
        System.out.println("3-Square root of a no.");
        System.out.println("4-Cube root of a no.");
        int x=s.nextInt();
        if (x==1)
        {
            System.out.println("enter 2 nos.");
            int a=s.nextInt();
            int b=s.nextInt();
            System.out.println("Smaller of 2 nos.="+ Math.min(a,b));
        }
        if (x==2)
        {
            System.out.println("enter 2 nos.");
            int a=s.nextInt();
            int b=s.nextInt();
            System.out.println("Larger of 2 nos.="+ Math.max(a,b));
        }
        if (x==3)
        {
            System.out.println("enter a no.");
            int a=s.nextInt();
            System.out.println("Square root of a no.="+ Math.sqrt(a));
        }
        if (x==4)
        {
            System.out.println("enter a no.");
            int a=s.nextInt();
            System.out.println("Cube root of a no.="+ Math.cbrt(a));
        }
    }
}