FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaExamples/WhileLoopDemo2.java at master · CMPundhir/JavaExamples · GitHub
CMPundhir
/
JavaExamples
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
7
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
JavaExamples
/
WhileLoopDemo2.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (23 loc) · 494 Bytes
Breadcrumbs
JavaExamples
/
WhileLoopDemo2.java
Copy path
File metadata and controls
24 lines (23 loc) · 494 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
import
java
.
util
.
Scanner
;
class
WhileLoopDemo2
{
public
static
void
main
(
String
[]
args
){
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Enter a number : "
);
int
a
=
sc
.
nextInt
();
int
max
=
0
,
min
=
0
;
//min = Integer.MAX_VALUE;
//max = Integer.MIN_VALUE;
while
(
a
!=
0
){
a
=
sc
.
nextInt
();
if
(
a
>
max
){
max
=
a
;
}
if
(
a
<
min
){
min
=
a
;
}
}
System
.
out
.
println
(
"min : "
+
min
);
System
.
out
.
println
(
"max : "
+
max
);
System
.
out
.
println
(
"loop finished"
);
}
}
Back
|
FazBrowse Home
|
New Git URL