FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaGB/lista_3_java/questao_3.java at main · githubdaestela/JavaGB · GitHub
githubdaestela
/
JavaGB
Public
Notifications
You must be signed in to change notification settings
Fork
0
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
JavaGB
/
lista_3_java
/
questao_3.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (29 loc) · 795 Bytes
Breadcrumbs
JavaGB
/
lista_3_java
/
questao_3.java
Copy path
File metadata and controls
36 lines (29 loc) · 795 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
28
29
30
31
32
33
34
35
36
/*Lista 3 Repetição: 3. Solicitar a idade de várias pessoas e imprimir: Total de pessoas
com menos de 21 anos. Total de pessoas com mais de 50 anos. O programa termina quando
idade for =-99. (WHILE)*/
package
lista_3_java
;
import
java
.
util
.*;
public
class
questao_3
{
public
static
void
main
(
String
args
[])
{
Scanner
input
=
new
Scanner
(
System
.
in
);
int
age
=
0
,
acm1
=
0
,
acm2
=
0
;
System
.
out
.
println
(
"Escreva sua idade: "
);
age
=
input
.
nextInt
();
while
(
age
>
0
&&
age
!=-
99
)
{
System
.
out
.
println
(
"Escreva sua idade: "
);
age
=
input
.
nextInt
();
if
(
age
<
21
)
{
acm1
++;
}
else
if
(
age
>
50
)
{
acm2
++;
}
}
System
.
out
.
println
(
"Foi digitado "
+
acm1
+
" pessoas com menos de 21 anos de idade e "
+
acm2
+
" pessoas com mais de 50 anos"
);
}
}
Back
|
FazBrowse Home
|
New Git URL