generated from microsoft/vscode-remote-try-java
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(3.3.3): Finished U3_L3_Activity_Three
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package Unit3; | ||
|
||
import java.util.Scanner; | ||
|
||
public class U3_L3_Activity_Three { | ||
public static void main(String[] args) { | ||
Scanner scanner = new Scanner(System.in); | ||
System.out.println("Enter in two Integers"); | ||
System.out.print("> "); | ||
int num1 = scanner.nextInt(); | ||
System.out.print("> "); | ||
int num2 = scanner.nextInt(); | ||
|
||
int ans = num1 + num2; | ||
|
||
System.out.println("\n" + num1 + " + " + num2 + " = ?"); | ||
System.out.print("> "); | ||
int guess = scanner.nextInt(); | ||
|
||
if (ans == guess) { | ||
System.out.println("Correct!"); | ||
} else { | ||
System.out.println("Wrong"); | ||
} | ||
|
||
scanner.close(); | ||
} | ||
} |