INTRO TO JAVA PLEASE SEE BELOW: When the provided integer n is divisible by 3, p
ID: 3891590 • Letter: I
Question
INTRO TO JAVA PLEASE SEE BELOW:
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.
CODE:
PART 2
Now we will do the fizzbuzz problem a little differently. Use the Boolean variables fizz and buzz in the conditions.
FizzBuzz.java 1 import java.util.Scanner; 3 public class FizzBuzz 4 5 public static void main(String[] args) Scanner in - new Scanner (System.in); 1n ebook-bjlo-2-ch03-sec07-cc-1 10 System.out.println("fizz"); 12 13 14 15 16 17 18 19 20 21 if ( System.out.println("buzz"); System.out.println("fizzbuzz"); 23 24 25 26 27 System.out.println (n); 28Explanation / Answer
Part1: ======= Blank1: ------ n%3 == 0 Blank2: ------ n%5 == 0 Blank3: ------ n%3 == 0 && n%5 == 0 Blank4: ------ !(n%3 == 0 && n%5 == 0) ========================================== Part2: ======= Blank1: ------ fizz Blank2: ------ buzz Blank3: ------ !(fizz && buzz)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.