Answer to Question #303771 in C for Kang

Question #303771

The FizzBuzz Game

by CodeChum Admin

Let's play a game of FizzBuzz! It works just like the popular childhood game "PopCorn", but with rules of math applied since math is fun, right?


Just print out "Fizz" when the given number is divisible by 3, "Buzz" when it's divisible by 5, and "FizzBuzz" when it's divisible by both 3 and 5!


1
Expert's answer
2022-02-28T08:30:18-0500
#include <stdio.h>

int main()
{
    int number;
    
    printf("Enter a Number: ");
    scanf("%d", &number);
    printf("\n");
    if ((number % 3 == 0) && (number % 5 == 0))
        printf("\nFizzBuzz");
    else if (number % 3 == 0)
        printf("\nFizz");
    else
        printf("\nBuzz");

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS