Computer Science, asked by Anonymous, 9 months ago

/*Java Program to Display Prime Numbers Between Intervals Using Function*/
//Whats problem in this code
import java.util.Scanner;
public class Main
{
public static void Prime(int num1,int num2)
{
int i,j,count=0;
for(i=num1;i<=num2;i++)
{
for (j=2;j<=i/2;j++)
{
if (i%j==0)
{
count++;
if (count<1)
{
System.out.print(i);
}
}
}
}
}
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter a new number :");
int num1 = sc.nextInt();
System.out.println("Enter a Second number :");
int num2 = sc.nextInt();
Prime(num1,num2);
}
}

Answers

Answered by vaibhavsingh78392715
1

Answer:

the line with String args[]

Similar questions