Last active
August 21, 2022 04:27
-
-
Save jnmontano/07fa57476a6410f32116f625a99f8431 to your computer and use it in GitHub Desktop.
Código Para Estructuras de Control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
int numeroIf = 0; | |
if (numeroIf>0) | |
System.out.println("La variable numeroIf es POSITIVA"); | |
else | |
System.out.println("La variable numeroIf es NEGATIVA"); | |
System.out.println("----------------------------------------"); | |
while (numeroIf<3){ | |
numeroIf++; | |
System.out.println("Bucle While -> " + numeroIf); | |
} | |
System.out.println("----------------------------------------"); | |
do{ | |
numeroIf++; | |
System.out.println("Bucle Do While -> " + numeroIf); | |
}while(numeroIf<3); | |
System.out.println("----------------------------------------"); | |
for (int numeroFor = 0 ; numeroFor <= 3 ; numeroFor++) | |
System.out.println("Bucle For -> " + numeroFor); | |
System.out.println("----------------------------------------"); | |
var estacion = "PRIMAVERA"; | |
switch (estacion){ | |
case "PRIMAVERA": | |
System.out.println("La estacion es PRIMAVERA"); | |
break; | |
case "VERANO": | |
System.out.println("La estacion es VERANO"); | |
break; | |
case "OTONO": | |
System.out.println("La estacion es OTONO"); | |
break; | |
case "INVIERNO": | |
System.out.println("La estacion es INVIERNO"); | |
break; | |
default: | |
System.out.println("No es ninguna estacion"); | |
System.out.println("----------------------------------------"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Codigo de Estructuras de Control