We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 22c659e + 1bf34d3 commit 5dfdcdbCopy full SHA for 5dfdcdb
C++/Fizz_Buzz.cpp
@@ -0,0 +1,28 @@
1
+#include<bits/stdc++.h>
2
+using namespace std;
3
+ vector<string> fizzBuzz(int n) {
4
+ vector<string>ans;
5
+ for(int i=1;i<=n;i++)
6
+ {
7
+ if((i)%15==0)
8
9
+ string str="FizzBuzz";
10
+ ans.push_back(str);
11
+ }
12
+ else if((i)%5==0){
13
+ string str="Buzz";
14
15
16
+ else if((i)%3==0){
17
+ string str="Fizz";
18
19
20
+ else
21
+ ans.push_back(to_string(i));
22
23
+ return ans;
24
25
+int main()
26
+{
27
+ vector<string> answer= fizzBuzz(5);
28
+}
0 commit comments