Assignment # 61 and Keep Guessing

Code

    /// Name: Tommy Oyuntseren
    /// Period: 7
    /// Program Name: KeepGuessing
    /// File Name: KeepGuessing.java
    /// Date: 12/14/2015

import java.util.Scanner;
import java.util.Random;

public class KeepGuessing
{
	public static void main(String[] args)
	{
		Scanner keyboard = new Scanner(System.in);

		Random r = new Random();

		byte SN = (byte)(1 + r.nextInt(10));
		byte guess = 0;
		System.out.println("Try to guess the secret number from 1 to 10!!!");
		System.out.println();
		
		{
			{
				System.out.print("Your guess is: ");
				guess = keyboard.nextByte();

				if (guess == SN) System.out.println("\nYou guessed!!! The number is "+SN+".");
				else System.out.println("You are wrong!!! Try again.");
			}
			while (guess!=SN);
		}
		
		{
			guess = 0;
		}
	}
}
 
  

Picture of the output

Assignment 61