-
-
Save JoseLuisGardunoArrieta/d5c2fd794acc4233ce97f5cb590b1c03 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