qfedu-basic-level/day7/d11.cpp

17 lines
251 B
C++
Raw Permalink Normal View History

2023-06-21 14:30:56 +08:00
#include <iostream>
using namespace std;
int main()
{
int i = 1, total = 0;
while (i <= 100)
{
if (i % 3 == 0)
total += i;
i++;
}
cout << "1~100的3的倍数和为: " << total << endl;
return 0;
}