- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA911.java
More file actions
Latest commit
60 lines (51 loc) · 1 KB
/
Copy pathA911.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
importjava.util.Scanner;
classA911
{
publicstaticvoidmain(String[] args)
{
Scanners1 = newScanner(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");
intstart = s1.nextInt();
System.out.println("Enter the End point");
intend = s1.nextInt();
System.out.println();
intx=0;
inta[] = newint[10];
for (inti=start;start<=end ;start++ )
{
intk=2;
for (intj=k;k<=start ;k++ )
{
if (start%k==0 )
{
break;
}
}
if (start==k)
{
if (x<=9)
{
a[x++]=start;
}
}
}
// Reverse an Array A
intz= a.length-1;
for (inti = 0;i<a.length ;i++ )
{
if (i<=z)
{
inttemp = a[i];
a[i] = a[z];
a[z] = temp;
z--;
}
}
//Printing the reverse array
for (inti=0;i<a.length ;i++ )
{
System.out.print(a[i]+" ");
}
}
}