-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patharrayprimer.java
More file actions
37 lines (35 loc) · 766 Bytes
/
Copy patharrayprimer.java
File metadata and controls
37 lines (35 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Write a description of class arrayprimer here.
*
* @author (Debdut Goswami)
* @version (3.1.4)
*/
import java.util.*;
public class arrayprimer
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the numbers?");
int arr[]=new int[5];
for(int i=0;i<5;i++)
{
arr[i]=sc.nextInt();
}
for(int i=0;i<5;i++)
{
int c=0;
for(int j=2;j<=arr[i];j++)
{
if(arr[i]%j==0)
{
c++;
}
}
if(c==1)
{
System.out.println(arr[i]+" is a prime number");
}
}
}
}