diff --git a/day6/homework/h1.cpp b/day6/homework/h1.cpp new file mode 100644 index 0000000..e9d27d1 --- /dev/null +++ b/day6/homework/h1.cpp @@ -0,0 +1,26 @@ +#include + +using namespace std; + +int main() +{ + int n; + cout << "请输入一个整数: "; + cin >> n; + + if (n % 3 == 0) + { + if (n % 5 == 0) + { + cout << "FizzBuzz" << endl; + } + else + { + cout << "Fizz" << endl; + } + } + else if (n % 5 == 0) + cout << "Buzz" << endl; + else + cout << n << endl; +}