Skip to content

Instantly share code, notes, and snippets.

@jnmontano
Last active August 21, 2022 04:27
Show Gist options
  • Save jnmontano/07fa57476a6410f32116f625a99f8431 to your computer and use it in GitHub Desktop.
Save jnmontano/07fa57476a6410f32116f625a99f8431 to your computer and use it in GitHub Desktop.
Código Para Estructuras de Control
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("----------------------------------------");
}
}
}
@jnmontano
Copy link
Author

Codigo de Estructuras de Control

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment