-
Notifications
You must be signed in to change notification settings - Fork 0
/
CiclosDos.java
50 lines (46 loc) · 983 Bytes
/
CiclosDos.java
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
public class CiclosDos{
public static void main(String args[]){
int i = 1, j = 99;
System.out.println("Serie con for: ");
for(i = 1; i <= 5; i++){
if( i < 5 ){
System.out.print(i + ", ");
System.out.print(j + ", ");
} else{
System.out.print(i + ", ");
System.out.print(j);
}
j--;
}
i = 1;
j = 99;
System.out.println("");
System.out.println("Serie con while: ");
while (i <= 5){
if( i < 5 ){
System.out.print(i + ", ");
System.out.print(j + ", ");
} else{
System.out.print(i + ", ");
System.out.print(j);
}
i++;
j--;
}
i = 1;
j = 99;
System.out.println("");
System.out.println("Serie con do while: ");
do{
if( i< 5 ){
System.out.print(i + ", ");
System.out.print(j + ", ");
} else{
System.out.print(i + ", ");
System.out.print(j);
}
i++;
j--;
}while(i <= 5);
}
}