Skip to content

Commit 2ebe8df

Browse files
shubhendra-20MadhavBahl
authored andcommitted
Rename day1.cpp to day1_solve.cpp (#192)
Solution to Fizz-Buzz Problem
1 parent 8ec0bcf commit 2ebe8df

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Day1/C++/day1_solve.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* @author: Shubhendra Singh <shubehndras21@gmail.com>
3+
* @github: https://github.com/shubhendra-20
4+
* @date: 25/01/2019
5+
*/
6+
7+
8+
#include <iostream>
9+
using namespace std;
10+
11+
int main() {
12+
int i,n;
13+
cin>>n;
14+
for(i=1;i<=n;i++)
15+
{
16+
if(i%3==0 && i%5==0)
17+
{
18+
cout<<"FizzBuzz ";
19+
continue;
20+
}
21+
if(i%3==0)
22+
{
23+
cout<<"Fizz ";
24+
continue;
25+
}
26+
else if(i%5==0)
27+
{
28+
cout<<"Buzz ";
29+
continue;
30+
}
31+
else
32+
cout<<i<<" ";
33+
}
34+
return 0;
35+
}

0 commit comments

Comments
 (0)