Skip to content

Commit

Permalink
Added fizzbuzz.c, README.md updated, object files include in .gitigno…
Browse files Browse the repository at this point in the history
…re (#4)

* Added fizzbuzz.c, README.md updated, object files include in .gitignore

* Update README.md
  • Loading branch information
Razdeep authored and MadhavBahl committed Dec 20, 2018
1 parent 30d111c commit 8a6df9e
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitignore
@@ -1,4 +1,7 @@
node_modules/
playground/
youtube/
Instagram/
Instagram/
a.out
.vscode/
*.o
34 changes: 34 additions & 0 deletions Day1/C/fizzbuzz.c
@@ -0,0 +1,34 @@
/**
* @author: Rajdeep Roy Chowdhury<rrajdeeproychowdhury@gmail.com>
* @github: https://github.com/razdeep
* @date: 20/12/2018
**/

#include <stdio.h>

int main()
{
int n;
printf("Enter a number upto which you want to find Fizzbuzz numbers ");
scanf("%d", &n);
for (int i = 1; i <= n; 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");
}
else
{
printf("%d\n", i);
}
}
return 0;
}
42 changes: 41 additions & 1 deletion Day1/README.md
Expand Up @@ -106,4 +106,44 @@ public class Fizzbuzz {

}
}
```
```
## C Implementation

### [Fizzbuzz.c](./C/fizzbuzz.c)

```c
/**
* @author: Rajdeep Roy Chowdhury<rrajdeeproychowdhury@gmail.com>
* @github: https://github.com/razdeep
* @date: 20/12/2018
**/

#include <stdio.h>

int main()
{
int n;
printf("Enter a number upto which you want to find Fizzbuzz numbers ");
scanf("%d", &n);
for (int i = 1; i <= n; 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");
}
else
{
printf("%d\n", i);
}
}
return 0;
}
```

0 comments on commit 8a6df9e

Please sign in to comment.