Assignemnt #58 and Hilo.java

Code

    import java.util.Random;
    import java.util.Scanner;;
    
    public class Hilo{
        public static void main(String[] args){
            
            Scanner keyboard = new Scanner(System.in);
            Random r = new Random();
            
            int a,num = 1 + r.nextInt(100);
            
            System.out.print("Guess a number 1 - 100");
            System.out.println("> ");
            a = keyboard.nextInt();
            
            if (a == num){
                System.out.print("right! it was" + num + " !!!!!");
            }
            else {
                System.out.println("nah it was " + num + ".");
            }
        }
    }
        
        
                   
    

Picture of the output

Assignment 58