Assignemnt #52 Guess
Code
///Name: Joshua Pell
///Period: 6
///Project Name: Guess
///File Name: Guess.java
///Date: 12/1/2015
import java.util.Scanner;
public class Guess
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int ans,num=2;
String name;
System.out.println("I'm thinking of a Number 1-10. What is it?");
ans = keyboard.nextInt();
if (ans == num)
{
System.out.println("You got it!");
}
else
{
System.out.println("Nope the answer was " + num + "!");
}
}
}
Picture of the output