1. FizzBuzz 2.0 by CodeChum Admin Remember the game of FizzBuzz from the last time? Well, I thought of some changes in the game, and also with the help of loops as well. Firstly, you'll be asking for a random integer and then loop from 1 until that integer. Then, Implement these conditions in the game: • print "Fizz" if the number is divisible by • print "Buzz" if the number is divisible by • print "Fizzbuzz" if the number is divisible by both 3 and 5 • print the number itself if none of the above conditions are met

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

PlsHelp ASAP

Program C

 

main.c
Test Cases
Executions
1. FizzBuzz 2.0
Fincludecstdie.h
nainO
int n:
by CodeChum Admin
main.c:20:5: error: 'else' without a previous 1f
20 |
else if("nS--e");
Remember the game of FizzBuzz from the last
time? Well, I thought of some changes in the
game, and also with the help of loops as well.
Firstly, you'll be asking for a random integer
and then loop from 1 until that integer. Then,
printf("Enter n: );
scanf("Xd,&n");
int ni - 0:
Expected Output
implement these conditions in the game:
while (nenn1):{
• print "Fizz" if the number is divisible by
Enter n: 15
if (A33-0 nXS-0);
{
11
12
• print "Buzz" if the number is divisible by
13
printf("fizzbuzz");
Fizz
14
• print "FizzBuzz" if the number is
15
divisible by both 3 and 5
16
else if("n3-0");
Buzz
• print the number itself if none of the
17
Fizz
printf("fizz");
above conditions are met
18
19
20
Fizz
21
else if("AS-0");
Input
Buzz
22
11
1. An integer
23
printf(buzz");
24
13
25
Output
26
14
27
FizzBuzz
The first line will contain a message prompt to
28
input the integer.
The succeeding lines will contain either a string
or an integer.
O Test Case 2
Enter n: 15
1
2
O Test Case 3
Fiz
4
Buzz
Fiz
Buzz
Transcribed Image Text:main.c Test Cases Executions 1. FizzBuzz 2.0 Fincludecstdie.h nainO int n: by CodeChum Admin main.c:20:5: error: 'else' without a previous 1f 20 | else if("nS--e"); Remember the game of FizzBuzz from the last time? Well, I thought of some changes in the game, and also with the help of loops as well. Firstly, you'll be asking for a random integer and then loop from 1 until that integer. Then, printf("Enter n: ); scanf("Xd,&n"); int ni - 0: Expected Output implement these conditions in the game: while (nenn1):{ • print "Fizz" if the number is divisible by Enter n: 15 if (A33-0 nXS-0); { 11 12 • print "Buzz" if the number is divisible by 13 printf("fizzbuzz"); Fizz 14 • print "FizzBuzz" if the number is 15 divisible by both 3 and 5 16 else if("n3-0"); Buzz • print the number itself if none of the 17 Fizz printf("fizz"); above conditions are met 18 19 20 Fizz 21 else if("AS-0"); Input Buzz 22 11 1. An integer 23 printf(buzz"); 24 13 25 Output 26 14 27 FizzBuzz The first line will contain a message prompt to 28 input the integer. The succeeding lines will contain either a string or an integer. O Test Case 2 Enter n: 15 1 2 O Test Case 3 Fiz 4 Buzz Fiz Buzz
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Basics of loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education