逻辑运算题1

This commit is contained in:
flykhan 2023-06-20 08:48:57 +08:00
parent 1acf92d7ab
commit 13211e1919
1 changed files with 26 additions and 0 deletions

26
day6/homework/h1.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <iostream>
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;
}