Professional Documents
Culture Documents
Atividade Prática 2
Atividade Prática 2
class Principal {
public static void main(String[] args) {
Scanner ler = new Scanner(System.in);
Random rand = new Random();
aleatorio = rand.nextInt(100);
System.out.println("Advinhe o numero");
int macaco_louco_e_nerfado = 0;
int[] aleatorios = new int[20];
class Principal {
public static void main(String[] args) {
Scanner ler = new Scanner(System.in);
Random rand = new Random();
if (aleatorios[c] % 2 != 0) {
capivara_mutante_do_rock [SITU_FREDDY_FAZZBEAR] =
molecula_malcriada[c];
SITU_FREDDY_FAZZBEAR++;
}
}
System.out.println("Numeros aleatorios:");
for (int c = 0; c < molecula_malcriada .length; c++) {
System.out.println(molecula_malcriada [c]);
}
class Principal {
public static void main(String[] args) {
Scanner ler = new Scanner(System.in);
Random rand = new Random();
class Principal
{
public static void main(String[] args) {
Random rand = new Random();
class Main {
public static void main(String[] args) {
Scanner ler = new Scanner(System.in);
if(contagem[c + 1] == nums[c]){
soma[c] += 1;
}
else{
c++;
}
System.out.print("\n" + soma_total);
}
}
9-) Busca Linear:
import java.util.Scanner;
import java.util.Arrays;
import java.util.Random;
if(aleatorios[c] == numero){
System.out.println("O numero " + numero + " foi encontrado! ");
flag = true;
break;
}
}
int contador = 0;
d2[c] = rand.nextInt(6)+1;
System.out.print(d1[c]);
soma[c] = d1[c] + d2[c];
System.out.print(" = " + soma[c] + "\n");
if(soma[c] == 7){
contador++;
}
}
System.out.println("A soma dos dados foi igual a 7, " + contador + " vezes.");
}
}