Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. int repeat = 1;
  2.  
  3. while (repeat == 1)
  4. {
  5.  
  6. String Msg, name; int num;
  7.  
  8. System.out.println("Enter Your Name:");
  9. Scanner input = new Scanner(System.in);
  10. name = input.nextLine();
  11.  
  12. System.out.println("Enter A Positive Number:");
  13. Scanner input1 = new Scanner(System.in);
  14. num = input1.nextInt();
  15.  
  16. if (num >= 0)
  17. {
  18. System.out.println("Your Favourite Number Is: "+ num);
  19. }
  20. else
  21. {
  22. System.out.println("Not a positive number");
  23. }
  24.  
  25. System.out.println("Repeat: 1 - Yes");
  26. Scanner input2 = new Scanner(System.in);
  27. repeat = input2.nextInt();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement