Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
FizzBang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ollie Rhodes
FizzBang
Commits
f84190b1
Commit
f84190b1
authored
Jan 20, 2020
by
Ollie Rhodes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
22a87fe5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
fizzBang.c
fizzBang.c
+35
-0
No files found.
fizzBang.c
0 → 100644
View file @
f84190b1
#include "stdio.h"
int
main
()
{
printf
(
"FizzBang Demo"
);
int
i
;
//loop number
int
fizzNum
=
0
;
//number of times fizz has occurred
int
bangNum
=
0
;
//number of times bang has occurred
for
(
i
=
1
;
i
<=
20
;
i
++
)
{
//repeat 20 times
printf
(
"
\n
"
);
//new line
if
(
i
%
3
==
0
&&
i
%
5
==
0
){
//if multiple of 3 and 5
printf
(
"FizzBang"
);
fizzNum
++
;
//increase count of both fizzNum and bangNum
bangNum
++
;
}
else
if
(
i
%
3
==
0
){
//if multiple of 3
printf
(
"Fizz"
);
fizzNum
++
;
//increase count of fizzNum
}
else
if
(
i
%
5
==
0
){
//if multiple of 5
printf
(
"Bang"
);
bangNum
++
;
//increase count of bangNum
}
else
{
//if not either of previous two
printf
(
"%d"
,
i
);
//print the loop number
}
}
printf
(
"
\n
"
);
//new line
printf
(
"%d"
,
fizzNum
);
//print the number of Fizz
printf
(
"
\n
"
);
printf
(
"%d"
,
bangNum
);
//print the number of Bangs
return
0
;
}
/*
*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment