测试一个整数能否被3整除

This commit is contained in:
flykhan 2023-06-16 16:32:44 +08:00
parent 2ffc4d5eaa
commit c9353fa3fe
1 changed files with 16 additions and 0 deletions

16
day5/d6.cpp Normal file
View File

@ -0,0 +1,16 @@
// 测试一个整数能否被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;
}