Ciclos

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author RACHEL

*/

public class Ciclo_For {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

int x;

int tope =20;

for (x=1;x<=tope;x=x+2)

System.out.println("SE IMPRIMIR EL VALOR: \""+ x);

}
/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author RACHEL

*/

public class prj_Ciclo_While {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

int x=1;

int tope =20;

while (x < 20)

System.out.println("SE IMPRIME EL VALOR: \""+ x);

x=x+1;

}
/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author RACHEL

*/

public class prj_do_while {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

int x=1;

do

System.out.println(x +" Hijo "+"\n");

x=x+2;

while (x<=5);

You might also like