c语言if函数,输入一个整数,判断并输出它是否是3的倍数?

如题所述

第1个回答  2020-04-21
#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
int x;
cout << "请输入整数:" << endl;
cin >> x;
if (x % 3)
cout << x << "不是3的倍数!" << endl;
else
cout << x << "是3的倍数!" << endl;

system("pause");
return 0;
}
相似回答