Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Write a program that asks the user for a number
- greater than 5 and prints all values between 1 and n
- that are multiples of 5 (i.e. evenly divisible by 5).*/
- package chapter4dash2cwpt1;
- import java.util.Scanner;
- public class Chapter4dash2CWpt1 {
- public static void main(String[] args)
- {
- Scanner keyboard = new Scanner(System.in);
- int n;
- System.out.println("Enter a numbet greater than 5.");
- n = keyboard.nextInt();
- for(int i = 1; i <= n; i++)
- {
- if(i%5 == 0)
- System.out.println(i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement