-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTp1ej10
More file actions
36 lines (30 loc) · 838 Bytes
/
Tp1ej10
File metadata and controls
36 lines (30 loc) · 838 Bytes
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
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package tp1prog2;
import java.util.Scanner;
public class Tp1prog2 {
static final int TAM = 9;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int aux1 = 0, aux2 = 0, i, a;
for(i = 0; i < TAM; i++){
if(aux1 == aux2)
aux1++;
else
aux2++;
}
if(aux1 == aux2){
for(a=0; a < TAM; a++){
System.out.println((2*a));
}
}else{
for(a=1; a < TAM+1; a++){
System.out.println(((2*a)-1));
}
}
}
}