Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* FizzBuzz added in C++ * Rename FizzBuzz.cpp.txt to FizzBuzz.cpp * updated Readme.md
- Loading branch information
1 parent
a5b7bf4
commit 95b9757
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @author dsdsharma | ||
* @date 20/12/2018 | ||
*/ | ||
|
||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int n; | ||
cout << "====Fizz Buzz ====" << endl; | ||
cout << "Enter the number: "; | ||
cin >> n; | ||
for(int i=1; i<=n; i++){ | ||
if(i%5==0 && i%3==0){ | ||
cout << "FizzBuzz "; | ||
}else if(i%3==0){ | ||
cout << "Fizz "; | ||
}else if(i%5==0){ | ||
cout << "Buzz "; | ||
}else{ | ||
cout << i << " "; | ||
} | ||
|
||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters