编写程序,输入一个整数n,判断整数n能否同时被3和5整除,输出结果 C++
1个回答
展开全部
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Please input n:";
cin >> n;
if (n%3==0 && n%5==0)
cout << n << " can be devided by 3 and 5." << endl;
else
cout << n << " cannot be devided by 3 and 5." << endl;
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询