16 lines
297 B
C++
16 lines
297 B
C++
|
// 测试一个整数能否被3整除
|
||
|
#include <iostream>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
unsigned int n;
|
||
|
cout << "请输入一个整数:";
|
||
|
cin >> n;
|
||
|
if (n % 3 == 0)
|
||
|
cout << "能被3整除" << endl;
|
||
|
else
|
||
|
cout << "不能被3整除" << endl;
|
||
|
return 0;
|
||
|
}
|