21 lines
320 B
C++
21 lines
320 B
C++
|
// 输入一个数,输出小于这个数所有偶数
|
||
|
#include <iostream>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
int n;
|
||
|
cout << "请输入一个数:";
|
||
|
cin >> n;
|
||
|
int i = 0;
|
||
|
while (i < n)
|
||
|
{
|
||
|
if (i % 2 == 0)
|
||
|
cout << i << "\t";
|
||
|
i++;
|
||
|
}
|
||
|
cout << endl;
|
||
|
|
||
|
return 0;
|
||
|
}
|