Advertisement
mrScarlett

Untitled

Oct 21st, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class HelloWorld
  3. {
  4. public static void main (String args[]){
  5. Scanner userInput= new Scanner(System.in);
  6. int x ;
  7. System.out.println(" Enter a number ");
  8.  
  9. x = userInput.nextInt();
  10.  
  11. int y = 8;
  12. if (x>y){
  13. System.out.println(x+" is greater than "+y);
  14. }
  15. else if (y>x){
  16. System.out.println(y+" is greater than "+x);
  17. }
  18. else{
  19. System.out.println("Both nums are equal");
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement