write using import java.util.package
Attachments:
Answers
Answered by
2
Answer:
import java.util.*;
class Prime
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a[]=new int[20];
int c=0;
System.out.println("Enter 20 numbers");
for(int i=0;i<20;i++)
{
c=0;
a[i]=sc.nextInt();
for(int j=1;j<=a[i];j++)
{
if(a[i]%j==0)
c++;
if(c==2)
{
System.out.println(a[i]+" is a prime number");
continue;
}
}
}
}
Similar questions
Math,
5 months ago
English,
5 months ago
Accountancy,
5 months ago
CBSE BOARD X,
11 months ago
Social Sciences,
11 months ago