Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
FB
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
thomas.unsworth
FB
Commits
c2bc2ee8
Commit
c2bc2ee8
authored
Dec 23, 2019
by
thomas.unsworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first
parents
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
fizzbuzz.docx
fizzbuzz.docx
+0
-0
main.c
main.c
+32
-0
No files found.
fizzbuzz.docx
0 → 100644
View file @
c2bc2ee8
File added
main.c
0 → 100644
View file @
c2bc2ee8
#include <stdio.h>
#include <stdlib.h>
int
main
()
{
//setting counters to 0
int
fizz
=
0
;
int
buzz
=
0
;
//for loop that loops from 1 to 20
for
(
int
i
=
1
;
i
<
21
;
i
++
){
if
(
i
%
3
==
0
&&
i
%
5
==
0
){
//checks the remainder is 0 for both 3 and 5
printf
(
"FizzBuzz
\n
"
);
fizz
+=
1
;
//increasing counters
buzz
+=
1
;
}
else
if
(
i
%
3
==
0
){
//checks remainder for i/3
printf
(
"Fizz
\n
"
);
fizz
+=
1
;
//increases counter
}
else
if
(
i
%
5
==
0
){
//checks remainder for i/5
printf
(
"Buzz
\n
"
);
buzz
+=
1
;
//increases counter
}
else
{
printf
(
"%i
\n
"
,
i
);
//prints number
}
}
//prints counters
printf
(
"%i
\n
"
,
fizz
);
printf
(
"%i
\n
"
,
buzz
);
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