FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/Reverse_Array_Elements_Program.java at main · sksalahuddin2828/Java · GitHub
sksalahuddin2828
/
Java
Public
Notifications
You must be signed in to change notification settings
Fork
59
Star
178
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
Reverse_Array_Elements_Program.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (22 loc) · 817 Bytes
Breadcrumbs
Java
/
Reverse_Array_Elements_Program.java
Copy path
File metadata and controls
27 lines (22 loc) · 817 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
java
.
util
.
Scanner
;
public
class
ReverseArray
{
public
static
void
main
(
String
[]
args
) {
Scanner
scanner
=
new
Scanner
(
System
.
in
);
System
.
out
.
print
(
"Please enter the total number you want to enter: "
);
int
number
=
scanner
.
nextInt
();
int
[]
array
=
new
int
[
number
];
for
(
int
i
=
0
;
i
<
number
;
i
++) {
System
.
out
.
print
(
"Enter the element "
+ (
i
+
1
) +
": "
);
array
[
i
] =
scanner
.
nextInt
();
}
for
(
int
i
=
0
;
i
<
number
/
2
;
i
++) {
int
temp
=
array
[
i
];
array
[
i
] =
array
[
number
-
1
-
i
];
array
[
number
-
1
-
i
] =
temp
;
}
System
.
out
.
println
(
"
\n
Reverse all elements of the array:"
);
for
(
int
element
:
array
) {
System
.
out
.
println
(
element
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL