Assignemnt #52 The Worst number-Guessing Game Ever
Code
///Tyler Hart
///period 5
///The Worst number-Guessing Game Ever
///Guess.java
///10/29/2015
import java.util.Scanner;
public class Guess
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int ans,cats=5;
String name;
System.out.println("Number 1-10?");
ans = keyboard.nextInt();
if (ans == cats)
{
System.out.println("you got it!");
}
else
{
System.out.println("Nope the answer was " + cats + "!");
}
}
}
Picture of the output