Skip to content

Added new version of Fizzbuzz program in C and updated ReadME.md #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Day1/C/fizzbuzz2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* @author: shashanknenar

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly fix the indentation for the comments in both the source code file as well as the README

* @date: 01/10/2020
*/


#include <stdio.h>

int main(void)
{
int i;
for (i=1; i<=100; i++)
{

if (i%15 == 0)
printf ("FizzBuzz\t");

else if ((i%3) == 0)
printf("Fizz\t");

else if ((i%5) == 0)
printf("Buzz\t");

else
printf("%d\t", i); //print
}

return 0;
}
36 changes: 35 additions & 1 deletion Day1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,40 @@ int main()
return 0;
}
```
### [fizzbuzz2.c](./C/fizzbuzz2.c)

```c
/*
* @author: shashanknenar
* @github: https://github.com/shashanknenar
* @date: 01/10/2020
*/

#include <stdio.h>

int main(void)
{
int i;
for (i=1; i<=100; i++)
{

if (i%15 == 0)
printf ("FizzBuzz\t");

else if ((i%3) == 0)
printf("Fizz\t");

else if ((i%5) == 0)
printf("Buzz\t");

else
printf("%d\t", i); //print
}

return 0;
}
```


## Python(3) Implementation

Expand Down Expand Up @@ -490,4 +524,4 @@ obj.solveFizzBuzzProblem(17);

The beauty of programming lies in the fact that there is never a single solution to any problem.

In case you have an alternative way to solve this problem, do contribute to this repository (https://github.com/CodeToExpress/dailycodebase) :)
In case you have an alternative way to solve this problem, do contribute to this repository (https://github.com/CodeToExpress/dailycodebase) :)