You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
300 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
//错误的代码原因double存在精度的问题
int main() {
int n;
double s = 0;
cin >> n;
for (double i = 0.1; i != n; i += 0.1) {
s += i;
cout << i << endl;
}
cout << s;
return 0;
}