Skip to content

Instantly share code, notes, and snippets.

@JoseLuisGardunoArrieta
Forked from eduardojesus12/Codigo6.java
Created November 29, 2024 16:30
Show Gist options
  • Save JoseLuisGardunoArrieta/d5c2fd794acc4233ce97f5cb590b1c03 to your computer and use it in GitHub Desktop.
Save JoseLuisGardunoArrieta/d5c2fd794acc4233ce97f5cb590b1c03 to your computer and use it in GitHub Desktop.
Código de otros 6
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