D. 小王的投资计划

Eddy 2023-10-30 21:46:21

谁会

共 2 条回复

zhouzixiao

#include

#include

using namespace std;

int main() {

double a;

int sum = 0;

cin >> a;

while (a <= 2000) {

    a = a * (1 + 0.05);

    sum++;

}

cout << sum;

return 0;

}

zhouzixiao

#include #include using namespace std; int main() { double a; int sum = 0; cin >> a; while (a <= 2000) { a = a * (1 + 0.05); sum++; } cout << sum; return 0; }