Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.06 KB | None | 0 0
  1. public class userNum {
  2.     public static void main (String[] args) {
  3.         int num;
  4.         char yn = 'y';
  5.        
  6.         do {
  7.             System.out.println("Enter a number: ");
  8.             num = Svetovid.in.readInt();
  9.            
  10.             if (num < 100)
  11.                 System.out.println("Number is lesser than 100");
  12.            
  13.              else if (num > 100)
  14.                 System.out.println("Number is greather than 100");
  15.              
  16.             else if (num ==100)
  17.                 System.out.println("Number is equal to 100");
  18.            
  19.             yn = Svetovid.in.readChar("Do you want to enter another number? y/N ");
  20.            
  21.             while (yn != 'y' && yn != 'Y' && yn != 'n' && yn != 'N')
  22.                 yn = Svetovid.in.readChar("Unauthorized character, please y/N only: ");
  23.            
  24.         } while (yn == 'y' || yn == 'Y');
  25.        
  26.         if (num == 42)
  27.             System.out.println("Goodbye, and thanks for all the fish.");
  28.        
  29.         else
  30.             System.out.println("Goodbye");
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement