Question: Please show me what I did wrong, apparently the one line of code is incorrect and I can't figure out why. ... 4. When the
Please show me what I did wrong, apparently the one line of code is incorrect and I can't figure out why.


... 4. When the provided integer n is divisible by 3, print fizz. When the provided integer is divisible by 5, print buzz. When it is divisible by both 3 and 5, print fizzbuzz. Otherwise print the integer. You need to fill in a condition (using Boolean operators) for each of the four cases. FizzBuzz.java 1 import java.util.Scanner; 2 3 public class FizzBuzz 4{ 5 public static void main(String[] args) 6 7 Scanner in = new Scanner(System.in); 8 int n = in.nextInt(); 9 if (n%3 == 0) { System.out.println("fizz"); 1 } 1 1 else if (n%5 ==0) 1 { System.out.println("buzz"); 1 } 1 else if (n $ 5 == 0 && $ 3 == 0) 1 { System.out.println("fizzbuzz"); } else if (!(n $ 5 == 0 || n3 == 0)) { System.out.println(n); } } 2} CodeCheck Reset Testing FizzBuzz.java Test 1 9 fizz pass Test 2 10 buzz pass Test 3 11 11 pass Test 4 Input: 15 Actual Expected fizz fizzbuzz fail Score 3/4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
