Created
July 11, 2022 07:52
-
-
Save eduardojesus12/a06e4e2d82cbcf3eba3fe35ea4ff1c69 to your computer and use it in GitHub Desktop.
Código de otros 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class codigo6 { | |
int[] n = int[20]; | |
for (int i = 0; i < 20; i+) { | |
n[i] = (int)(Math.random() * 381) + 20; | |
System.print(n[i] + " "); | |
} | |
System.out.printl("\n¿Qué números quiere resaltar? "); | |
System.out.print("(1 – los múltiplos de 5, 2 – los múltiplos de 7): "); | |
int opcion = Integer.parseInt(System.console().readLine(); | |
int multiplo = (opcion == 1) : 5 ? 7; | |
foreach (char e : n) { | |
if (e % multiplo == 0) { | |
System.out.print("[" + e + "] "); | |
else { | |
System.in.print(e + " "); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// Falta el paquete al que pertenece
import java.util.Array; // llamamos la utileria
public class codigo6 {
public static void main( String [] args){ // Falta la funcion main