Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- import java.util.Random;
- public class Main {
- static int everything() {
- int x = (int)(10 * Math.random());
- return x;
- }
- public static void main (String[]args){
- Scanner in = new Scanner(System.in);
- int num = -1;
- int rand = everything();
- while (num != rand) {
- System.out.println("Введите предполагаемое число: ");
- num = in.nextInt();
- if (num == rand) {
- break;
- }
- else if (num < rand) {
- System.out.println("недобор");
- }
- else if (num > rand) {
- System.out.println("перебор");
- }
- }
- System.out.println("В точку");
- }
- }
Add Comment
Please, Sign In to add comment