Compare commits
5
Commits
54ba317e13
...
672e3cf27d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
672e3cf27d | ||
|
|
7af7a01592 | ||
|
|
d459661d0a | ||
|
|
12e68911b2 | ||
|
|
c4e0d4f215 |
No files matched your search
@@ -5,15 +5,17 @@ import java.util.Scanner;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Scanner sc = new Scanner(System.in);
|
Scanner sc = new Scanner(System.in);
|
||||||
final String dias[] = {"Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado", "Domingo"};
|
final String dias[] = {"Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"};
|
||||||
|
|
||||||
System.out.println("Día de la semana:");
|
System.out.println("Día de la semana:");
|
||||||
String dia = sc.next();
|
String dia = sc.next();
|
||||||
for(int i = 0; i < dias.length; i++){
|
for(int i = 0; i < dias.length; i++){
|
||||||
if(dias[i].equalsIgnoreCase(dia)){
|
if(dias[i].equalsIgnoreCase(dia)){
|
||||||
System.out.printf("Los %s son %s\n", dia, (i < 5) ? "lectivos" : "fines de semana");
|
System.out.printf("Los %s son %s\n", dia, (i < 5) ? "lectivos" : "fines de semana");
|
||||||
|
sc.close();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.println("ERROR: Día inválido");
|
||||||
sc.close();
|
sc.close();
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,10 @@ void main() {
|
|||||||
result = n1 * n2;
|
result = n1 * n2;
|
||||||
break;
|
break;
|
||||||
case '/':
|
case '/':
|
||||||
|
if (n2 == 0){
|
||||||
|
System.out.println("Imposible dividir entre 0");
|
||||||
|
return;
|
||||||
|
}
|
||||||
result = n1 / n2;
|
result = n1 / n2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import java.util.Scanner;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Scanner sc = new Scanner(System.in);
|
Scanner sc = new Scanner(System.in);
|
||||||
int mayor = 0;
|
int mayor = Integer.MIN_VALUE;
|
||||||
System.out.print("Escribe tres numeros: ");
|
System.out.print("Escribe tres numeros: ");
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
int n = sc.nextInt();
|
int n = sc.nextInt();
|
||||||
|
|||||||
@@ -11,7 +11,11 @@ void main() {
|
|||||||
h = sc.nextInt();
|
h = sc.nextInt();
|
||||||
m = sc.nextInt();
|
m = sc.nextInt();
|
||||||
s = sc.nextInt();
|
s = sc.nextInt();
|
||||||
s ++;
|
if (h >= 24 || m >= 60 || s >= 60){
|
||||||
|
System.out.println("Error: Hora inválida");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
s++;
|
||||||
// Espagueti máximo xd
|
// Espagueti máximo xd
|
||||||
if(s > 59){
|
if(s > 59){
|
||||||
s = 0;
|
s = 0;
|
||||||
@@ -20,7 +24,6 @@ void main() {
|
|||||||
m = 0;
|
m = 0;
|
||||||
h++;
|
h++;
|
||||||
if(h > 23){
|
if(h > 23){
|
||||||
m = 0;
|
|
||||||
h = 0;
|
h = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user