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

INGENIERÍA EN SISTEMAS COMPUTACIONALES

Ejercicios 2

ASIGNATURA:

FUNDAENTOS DE PROGRAMACION

UNIDAD:

PRESENTA:

ANDRIK HERRERA PEREZ

No CONTROL:

226z0262

Docente:

Roberto cazares centeno

Tlalixcoyan, Ver. A 07 de noviembre del 2022


Do
/**

* @(#)Do.java

* @author Andrik Herrera Perez

* @version 1.00 2022/11/13

*/

public class Do {

public Do() {

public static void main(String[] args) {

int cont=0;

do{

cont++;

System.out.println("entro al do while"+cont+"veces");

cont++;

}while(cont<10);

}
FOR
/**

* @(#)For.java

* @author Andrik Herrera Perez

* @version 1.00 2022/11/13

*/

import java.util.Scanner;

public class For {

public For() {

public static void main(String[] args) {

Scanner leer = new Scanner(System.in);

int x=0;

int nom=0;

for (x=0; x<10; x++);

System.out.println("Dame el numero");

nom=leer.nextInt();

};

}
While
/**

* @(#)While.java

* @author Andrik Herrera Perez

* @version 1.00 2022/11/13

*/

public class While {

public While() {

public static void main(String[] args) {

int cont=1;

int salida=0;

while(cont== 0);

System.out.println("entro al while");

if(salida == 0)

salida=1;

}
Switch
/**

* @(#)Switch.java

* @author Andrik Herrera Perez

* @version 1.00 2022/11/13

*/

public class Switch {

public Switch() {

public static void main(String[] args) {

int cont=0;

do{

switch(opcion){

case:1

System.out.println("opcion1");

break;

case:2

System.out.println("opcion2");

break;

case:3

cont=1

break;

default:cont=0

}[while(cont==0)];

You might also like