forked from CodeToExpress/dailycodebase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfizzbuzz.c
More file actions
34 lines (32 loc) · 651 Bytes
/
fizzbuzz.c
File metadata and controls
34 lines (32 loc) · 651 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
}