public class Ejercicio { public static void Main(string[] args) { int var1 = 4; string var2 = "La variable 1 vale "; if (var1 < 4) { int var3 = 2; int var4 = var1 + var3; Console.WriteLine("La variable 4 vale: " + var4); } Console.WriteLine(var2 + var1); } }
int x=0; boolean flag = false; while ((x<10) && !flag) { System.out.println(x); x++; }
public class Test { public static void Main() { double x = 1243.73; int c; int a; a = (int) x; c = (int)1234.73; System.Console.WriteLine(a); } }
int main() { int i; for ( i=0 ; i<5 ; i++ ) { printf( "Hola\n" ); } }
/* Código Uno*/ int x= 0; do { System.out.println(x); x++; } while (x<10); /* Código Dos */ int y= 0; while (y<10){ System.out.println(y); y++; }
int x=1; switch (x) { case 1: System.out.println("Uno"); case 2: System.out.println("Dos"); case 3: System.out.println("Tres"); default: System.out.println("Otro número"); }
public class EmpleadoApp { public static void main(String[] args) { //Creamos un array de objetos de la clase empleados Empleado arrayObjetos[]=new Empleado[3]; //Creamos objetos en cada posicion arrayObjetos[0]=new Empleado("Fernando", "Ureña", 23, 1000); arrayObjetos[1]=new Empleado("Epi", "Dermis", 30, 1500); arrayObjetos[2]=new Empleado("Blas", "Femia", 25, 1200); //Recorremos el array para calcular la suma de salarios //Linea 1... } }
public static void main(String[] args) { int a = 1; boolean b = false; if (a < 0 | b == true){ System.out.println("true"); } else { System.out.println("false"); } }
int x= 0; do { System.out.println(x); x++; } while (x<10); int y= 0; while (y<10){ System.out.println(y); y++; }
$guru = true; $variable = ($guru) ? "Eres gurú" : "No eres gurú"; echo $variable;
int x = 5; int y = 5; y *= x++; System.out.println(y);