qfedu-basic-level/day6/homework/h1.cpp

27 lines
401 B
C++
Raw Normal View History

2023-06-20 08:48:57 +08:00
#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;
}