Preview only show first 10 pages with watermark. For full document please download

Técnicas De Programação - Adivinhe

Trabalhos realizados na disciplina

   EMBED


Share

Transcript

import java.util.*;, , public class Adivinhe , {, , public static void main(String[] args), {, , Scanner input = new Scanner(System.in);, Random randomNumbers = new Random();, int y = 1;, do{ , int r = 1 + randomNumbers.nextInt(1000);, , int x;, , " System.out.print(""Adivinhe o numero entre 1 e 1000: "");", x = input.nextInt();, , while(x != r), {, if(x > r){ , " System.out.printf(""Digite um valor MENOR que %d : , x); x = input.nextInt(); } else{ System.out.printf(""Digite um valor MAIOR que %d: ", x); x = input.nextInt();, }, , , }, , " System.out.print(""PARABÉNS"," ACERTOU !\n\n"");" do{, " System.out.print("" Você deseja jogar novamente? Digite: 1 -> SIM - 0 ->NÃO: "");", y = input.nextInt();, }while((y != 0) && (y != 1));, }while(y == 1);, " System.out.print(""\n\nOBRIGADO ! POR JOGAR :D"");", }, },