Skip to content
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

Added new version of fizzbuzz in C and updated README.md by Sarveswar #338

Open
wants to merge 3 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
24 changes: 24 additions & 0 deletions Day1/C/fizzbuzzy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* @author: anonymousksr
* @date: 01/10/2020
Copy link
Member

Choose a reason for hiding this comment

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

Please fix this indentation

*/
#include <stdio.h>

int main(void)
{
int i;
for(i=1; i<=100; i++)
{
if(((i%3)||(i%5))== 0)
printf("number= %d FizzBuzz\n", i);
else if((i%3)==0)
printf("number= %d Fizz\n", i);
else if((i%5)==0)
printf("number= %d Buzz\n", i);
else
printf("number= %d\n",i);

}

return 0;
}
37 changes: 16 additions & 21 deletions Day1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,34 +122,27 @@ public class Fizzbuzz {

#include <stdio.h>

int main()
int main(void)
{
int n;
printf("Enter a number upto which you want to find Fizzbuzz numbers ");
scanf("%d", &n);
for (int i = 1; i <= n; i++)
int i;
for(i=1; i<=100; i++)
{
if (i % 5 == 0 && i % 3 == 0)
{
printf("FizzBuzz\n");
}
else if (i % 5 == 0)
{
printf("Buzz\n");
}
else if (i % 3 == 0)
{
printf("Fizz\n");
}
if(((i%3)||(i%5))== 0)
printf("number= %d FizzBuzz\n", i);
else if((i%3)==0)
printf("number= %d Fizz\n", i);
else if((i%5)==0)
printf("number= %d Buzz\n", i);
else
{
printf("%d\n", i);
}
printf("number= %d\n",i);

}

return 0;
}
```


## Python(3) Implementation

### [fizzbuzz.py](./Python3/fizzbuzz.py)
Expand Down Expand Up @@ -256,6 +249,8 @@ int main()
}
```



### [C# Solution](./C#/FizzBuzz.cs)

```cs
Expand Down Expand Up @@ -410,4 +405,4 @@ for ($i=1; $i <= $num; $i++) {

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) :)