Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
While
SUBMITTED BY:
Guest
DATE:
July 16, 2014, 12:53 a.m.
FORMAT:
JavaScript
SIZE:
629 Bytes
Raw
Download
Tweet
HITS:
946
Go to comments
Report
import
java
.
util
.
Scanner
;
public
class
While6
{
public
static
void
main
(
String
[]
ar
)
{
Scanner
teclado
=
new
Scanner
(
System
.
in
);
int
x
,
valor
,
pares
,
impares
;
x
=
1
;
pares
=
0
;
impares
=
0
;
while
(
x
<
5
){
System
.
out
.
print
(
"Valor 1:"
);
valor
=
teclado
.
nextInt
();
if
(
valor
%
2
==
0
){
pares
=
pares
+
1
;
}
else
{
impares
=
impares
+
1
;
}
x
=
x
+
1
;
}
System
.
out
.
print
(
"Numeros pares"
);
System
.
out
.
println
(
pares
);
System
.
out
.
print
(
"Numeros impares"
);
System
.
out
.
print
(
impares
);
}
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus