- 求数
输出 1∼999 中有因数 3 ,且至少有一位数字是 5 的数。
#include <iostream>
using namespace std;
int main()
{
int i , ge , shi , bai ;
for(i = 1 ; i <= 999 ; i++)
{
bai = i / 100 ;
shi = i % 100 / 10 ;
ge = i % 100 % 10 ;
if ((i%3==0) && (bai==5 || shi== 5 || ge == 5))
cout << i << endl ;
}
return 0 ;
}