Logic & Coding Assignment3 FIZZ BUZZ
Given an integer n, for every integer i <= n, the task is to print
“FizzBuzz”if i is divisible by 3 and 5, “Fizz” if i is divisible by 3,
“Buzz” if i is divisible by 5 or i (as a string) if none of the conditions are true.
Example:
Input: n = 3
Output: [1 2 Fizz]
Input: n = 5
Output: [1 2 Fizz 4 Buzz]
Input: n = 19
Output: [1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz]
import java.util.Scanner;
public class assignment3 {
public static void main(String args[]) {
// Out of bounds!!!
Scanner myScanner = new Scanner(System.in); //Your scanner initialized, use as you see fit.
System.out.println("Please input a number");
int num = myScanner.nextInt();
//Out of bounds!!!
}
}