-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA911.java
More file actions
60 lines (51 loc) · 1 KB
/
A911.java
File metadata and controls
60 lines (51 loc) · 1 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import java.util.Scanner;
class A911
{
public static void main(String[] args)
{
Scanner s1 = new Scanner(System.in);
System.out.println("--- Pgram will print first 10 PRIME num from given range in a REVERSE Order -----");
System.out.println("Enter the Start point");
int start = s1.nextInt();
System.out.println("Enter the End point");
int end = s1.nextInt();
System.out.println();
int x=0;
int a[] = new int[10];
for (int i=start;start<=end ;start++ )
{
int k=2;
for (int j=k;k<=start ;k++ )
{
if (start%k==0 )
{
break;
}
}
if (start==k)
{
if (x<=9)
{
a[x++]=start;
}
}
}
// Reverse an Array A
int z= a.length-1;
for (int i = 0;i<a.length ;i++ )
{
if (i<=z)
{
int temp = a[i];
a[i] = a[z];
a[z] = temp;
z--;
}
}
//Printing the reverse array
for (int i=0;i<a.length ;i++ )
{
System.out.print(a[i]+" ");
}
}
}