#include<iostream>
using namespace std;
int main()
{
int num = 0;
cout << "please input num" << endl;
cin >> num;
if (num % 3 == 0)
{
if (num % 5 == 0)
cout << "能被3和5整除。" << endl;
else
cout << " 能被3整除。"<<endl;
}
else
{
if (num % 5 == 0)
cout << " 能被5整除。" << endl;
else
cout << " 不能被3和5整除。"<<endl;
}
return 0;
}
4. 编写程序,要求;输入一个整数,判断其能否被3、5整除,并输出以下信息之一。 (1) 能被3和5整除。 (2) 能被3整除。 (3) 能被5整除。 (4) 不能被3和5整除。
最新推荐文章于 2023-09-07 14:33:49 发布