0% found this document useful (0 votes)
43 views7 pages

Arreglos Con While

The document contains code for several Java programs that all follow a similar structure: 1) They declare arrays to hold data like letters, numbers, IDs, etc. that is input by the user. 2) They use a for loop to input the data into the arrays. 3) They use another for loop to output the contents of the arrays. 4) They ask the user if they want to repeat and use a while loop to repeat the process if desired.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views7 pages

Arreglos Con While

The document contains code for several Java programs that all follow a similar structure: 1) They declare arrays to hold data like letters, numbers, IDs, etc. that is input by the user. 2) They use a for loop to input the data into the arrays. 3) They use another for loop to output the contents of the arrays. 4) They ask the user if they want to repeat and use a while loop to repeat the process if desired.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

import java.util.

Scanner;

public class Alphabet {

public static void main(String args[]) {

String [] alphabet= new String [26];

Scanner leer = new Scanner(System.in);

int salida=0;

do{

for(int i=0;i<=25;i++) {

System.out.println(" Ingrese letra " + i + "\n");

alphabet[i]=leer.next();

for (int i=0; i<=25;i++) {

System.out.println(" the letter alphabet is " + alphabet [i]);

System.out.println("Desea repetir la ejecución? SI = 0 , NO = 1");

salida=leer.nextInt();

while(salida==0);

}
import java.util.Scanner;

public class Numeros {

public static void main(String[]args) {

int i=0;

int cont=0;

int[] cadena = new int[500];

int salida=0;

System.out.println("los números de 1 a 1000 de 2 en 2 son:");

Scanner leer= new Scanner(System.in);

do{

for (i=2; i<=1000; i=i+2) {

cadena[cont]= i;

cont=cont + 1;

System.out.println(i);

System.out.println("Desea repetir la ejecución? SI = 0 , NO = 1");

salida=leer.nextInt();

while(salida==0);

}
}

import java.util.Scanner;

public class carros {

public static void main(String[]args) {

System.out.println("las placas de 10 carros son: \n");

Scanner leer = new Scanner(System.in);

String[] placas={
"JXV321","DON53E","COZ92E","FOE08B","GTO07D","DXL35C","STA43D","JYY46C","SRY21D","RXR
29D"};

int salida=0;

while (salida==0) {

for (int i=0; i<=9; i++) {

System.out.println(placas[i]);

System.out.println("Desea repetir la ejecución? SI = 0 , NO = 1");

salida=leer.nextInt();

}
import java.util.Scanner;

public class motos {

public static void main(String[]args) {

System.out.println("las placas de 10 motos son: \n");

Scanner leer = new Scanner(System.in);

String[] placas={
"JXV321","DON53E","COZ92E","FOE08B","GTO07D","DXL35C","STA43D","JYY46C","SRY21D","RXR
29D"};

int salida=0;

while (salida==0) {

for (int i=0; i<=9; i++) {

System.out.println(placas [i]);

System.out.println("Desea repetir la ejecución? SI = 0 , NO = 1");

salida=leer.nextInt();

}
import java.util.Scanner;

public class Cedulas {

public static void main(String args[]) {

int salida=0;

int [] cedula= new int [20];

Scanner leer = new Scanner(System.in);

do{

for(int i=0;i<=19;i++) {

System.out.println(" Ingrese cedula " + i + "\n");

cedula[i]=leer.nextInt();

for (int i=0; i<=19;i++) {

System.out.println(" La " + i + " Cedula es "+ cedula [i]);

System.out.println("Desea repetir la ejecución? SI = 0 , NO = 1");

salida=leer.nextInt();

while(salida==0);

}
import java.util.Scanner;

public class Tallas {

public static void main(String[]args) {

Scanner leer = new Scanner(System.in);

String [] cadena = {
"12","8","10","16","8","10","12","10","6","16","12","8","10","16","8","6","16",

"8","6","16","12","8","8","6","8","10","12","8","10","6"};

System.out.println("las tallas de 30 usuarios son:");

int salida=0;

do{

for (int i=0; i<=29; i++) {

System.out.println(" La " + i + " Talla es " + cadena[i]);

System.out.println("Desea repetir la ejecución? SI = 0 , NO = 1");

salida=leer.nextInt();

while(salida==0);

}
import java.util.Scanner;

public class peso {

public static void main(String[]args) {

Scanner leer = new Scanner(System.in);

String [] pesos = {
"50","78","64","54","67","80","77","68","64","76","56","79","82","58","69","62","46",

"48","51","45","65","43","53","61","81","42","63","72","71","49"};

System.out.println("los pesos de 30 usuarios son:");

int salida=0;

while (salida==0) {

for (int i=0; i<=29; i++) {

System.out.println(" El " + i + " Peso es " + pesos [i]);

System.out.println("Desea repetir la ejecución? SI = 0 , NO = 1");

salida=leer.nextInt();

You might also like