This file contains hidden or 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
| import java.util.Scanner; | |
| public class Triangle { | |
| public static void main(String[] args) { | |
| Scanner input = new Scanner(System.in); | |
| System.out.println("Enter a number:"); | |
| while(input.hasNext()){ | |
| int number = input.nextInt(); | |
| if(number % 2 == 0){ | |
| System.out.println("You entered an even number.\n(Please enter odd instead)"); |
NewerOlder