irishstorm

sghsgfh

Nov 4th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class ex7e
  4. {
  5. public static void main(String[] args)
  6. {
  7. Scanner input = new Scanner(System.in);
  8. int count = 0;
  9. char option;
  10.  
  11. do
  12. {
  13. System.out.print("Please enter a number : ");
  14. int num = input.nextInt();
  15. System.out.println();
  16. count = 0;
  17.  
  18. if(num <= 10)
  19. {
  20. while( count < 7)
  21. {
  22. System.out.println("Less than 10");
  23. count++;
  24. }
  25. }
  26. else if( num >= 10)
  27. {
  28. while( count < 4)
  29. {
  30. System.out.println("Greater than 10");
  31. count++;
  32. }
  33. }
  34. System.out.print("Would you like to enter another number : y/n? ");
  35. option = input.next().charAt(0);
  36. System.out.println();
  37. }
  38. while(option == 'y' || option == 'Y');
  39.  
  40. System.out.print("Goodbye!");
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment