Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class userNum {
- public static void main (String[] args) {
- int num;
- char yn = 'y';
- do {
- System.out.println("Enter a number: ");
- num = Svetovid.in.readInt();
- if (num < 100)
- System.out.println("Number is lesser than 100");
- else if (num > 100)
- System.out.println("Number is greather than 100");
- else if (num ==100)
- System.out.println("Number is equal to 100");
- yn = Svetovid.in.readChar("Do you want to enter another number? y/N ");
- while (yn != 'y' && yn != 'Y' && yn != 'n' && yn != 'N')
- yn = Svetovid.in.readChar("Unauthorized character, please y/N only: ");
- } while (yn == 'y' || yn == 'Y');
- if (num == 42)
- System.out.println("Goodbye, and thanks for all the fish.");
- else
- System.out.println("Goodbye");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement