Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package myApp;
- import java.util.Scanner;
- public class class03_ex05 {
- public static void main(String[] args) {
- //init vars
- int n = 0;
- //usage msg
- System.out.println("Integer: ");
- //open in_Stream, parse & close
- Scanner s = new Scanner(System.in);
- n = s.nextInt();
- s.close();
- //loop n times
- for (int i=1; i <= n; i+=1) {
- //if current i divided by 7 is Integer, print "boom!" - otherwise print i
- System.out.println( (i%7 == 0)?"boom!":i );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment