Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. /*Write a program that asks the user for a number
  2. greater than 5 and prints all values between 1 and n
  3. that are multiples of 5 (i.e. evenly divisible by 5).*/
  4.  
  5. package chapter4dash2cwpt1;
  6. import java.util.Scanner;
  7.  
  8. public class Chapter4dash2CWpt1 {
  9.  
  10. public static void main(String[] args)
  11. {
  12. Scanner keyboard = new Scanner(System.in);
  13. int n;
  14. System.out.println("Enter a numbet greater than 5.");
  15. n = keyboard.nextInt();
  16. for(int i = 1; i <= n; i++)
  17. {
  18. if(i%5 == 0)
  19. System.out.println(i);
  20. }
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement