From 13211e191956bafc0657ce42426bb840a3c2b24d Mon Sep 17 00:00:00 2001 From: flykhan Date: Tue, 20 Jun 2023 08:48:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=BF=90=E7=AE=97=E9=A2=981?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day6/homework/h1.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 day6/homework/h1.cpp 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; +}