Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Task For this problem. you will ned to create code that will output \"iz2\" for

ID: 3876847 • Letter: T

Question

Task For this problem. you will ned to create code that will output "iz2" for multiples of 3, "buz" for multiples of S, and "fizbuz" for multiples of both 3 and 5. A function with one input is provided. Modify the function provided to do the following: Define an empty variable called "finalans f the inut number is a muliple of 3, output the input mumber, a white space, and the word "fizz If the imput number is a multiple of 5, output the imput mmher, a white space. and the word-buzz is a multiple of 3 and S, output the input number, a white space, and the word fizzbuzz f the input number is a not of multiple of 3 or S, output the input number, a white space, followed by the sentence : This number is not divisible by 3 or t:If you're not sure how to check if something is evenly divisible by a number, googling "modulo programming" should help. Input Format The input is defined as uml and will contain an integer Constraints Output Format Print the number followed by a space and then your resalt Hint: You can add a white space by adding a space before your outpat or adding a string containing a white space character between your number and resul. Sample Input o

Explanation / Answer

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>
<p id="demo1"></p>
<p id="demo2"></p>

<script>
var num=45;
document.getElementById("demo").innerHTML = Sample(num);


var num=6;
document.getElementById("demo1").innerHTML = Sample(num);


var num=10;
document.getElementById("demo2").innerHTML = Sample(num);

function Sample(num) {
   console.log(num);
   if(num%3 == 0 && num%5 == 0)
   return num+ " fizzbuzz"
else if(num%3 == 0)
   return num+" fizz"
else if(num%5 == 0)
   return num+" buzz"
}

</script>

</body>
</html>

<! -- Output

45 fizzbuzz

6 fizz

10 buzz
-->

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote