Skip to content

Commit 22a18f9

Browse files
mayank-17MadhavBahl
authored andcommitted
Create day1-fizzbuzz-mayank (#118)
1 parent f816756 commit 22a18f9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Day1/C++/day1-fizzbuzz-mayank

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
int main() {
6+
int n;
7+
cout << "Enter the number: \n";
8+
cin >> n;
9+
for(int i = 1; i <= n; i++) {
10+
if(i % 5 == 0 && i % 3 == 0){
11+
cout << "FizzBuzz" << "\n";
12+
} else if(i % 3 == 0) {
13+
cout << "Fizz" << "\n";
14+
} else if(i % 5 == 0) {
15+
cout << "Buzz" << "\n";
16+
} else {
17+
cout << i << "\n";
18+
}
19+
}
20+
return 0;
21+
}

0 commit comments

Comments
 (0)