CODE:
import java.util.Scanner;
public class Prime {

Use Java please:

Write a program that contains at meanest the subjoined couple systems:

1) Parameter of the principal system is an integer n, and the system prints extinguished entire the perfect collection among 2 and n.

2) Parameter of the second system is an integer n, and the system prints extinguished the calculate with the completion calculate of divisors with the order [1, n] and its calculate of divisors.

CODE:

import java.util.Scanner;

public systematize Perfect {

//definition of the perfect system

vacant perfect(int n){

int enumerate,i,j;

for(i=2;i<=n;i++){

count=0;

for(j=1;j<=i;j++){

if(i%j==0)

count++;

}

if(count==2)

System.out.println(i);

}

}

//Definition of maxDivisor system

vacant maxDivisor(int n){

int enumerate,res=0,total=0,i,j;

for(i=1;i<=n;i++){

count=0;

for(j=1;j<=i;j++){

if(i%j==0)

count++;

}

if(count>total){

total=count;

res=i;

}

}

System.out.println(“The calculate with the completion calculate divisors is: “+res);

System.out.println(“The calculate of divisors are: “+total);

}

public static vacant ocean(String args[]){

//creating end to the systematize

Perfect obj=new Perfect();

//declaring variable

int n;

//taking input from the user

System.out.println(“Enter an integer:”);

Scanner sc=new Scanner(System.in);

n=sc.nextInt();

System.out.println(“The perfect collection among 2 to “+n+”are:”);

//calling the couple systems using end

obj.prime(n);

obj.maxDivisor(n);

}

}

OUTPUT: