fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cstdio>
  4. using namespace std;
  5.  
  6. int main() {
  7. double v = 1.21077;
  8. v *= 100000;
  9. for(int p=0; p<20; ++p)
  10. printf("%d : %.*f\n", p, p, v);
  11. for(int p=0; p<20; ++p)
  12. cout << setw(2) << p << " : " << fixed << setprecision(p) << v << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
0 : 121077
1 : 121077.0
2 : 121077.00
3 : 121077.000
4 : 121077.0000
5 : 121077.00000
6 : 121077.000000
7 : 121077.0000000
8 : 121077.00000000
9 : 121077.000000000
10 : 121077.0000000000
11 : 121076.99999999999
12 : 121076.999999999985
13 : 121076.9999999999854
14 : 121076.99999999998545
15 : 121076.999999999985448
16 : 121076.9999999999854481
17 : 121076.99999999998544808
18 : 121076.999999999985448085
19 : 121076.9999999999854480848
 0 : 121077
 1 : 121077.0
 2 : 121077.00
 3 : 121077.000
 4 : 121077.0000
 5 : 121077.00000
 6 : 121077.000000
 7 : 121077.0000000
 8 : 121077.00000000
 9 : 121077.000000000
10 : 121077.0000000000
11 : 121076.99999999999
12 : 121076.999999999985
13 : 121076.9999999999854
14 : 121076.99999999998545
15 : 121076.999999999985448
16 : 121076.9999999999854481
17 : 121076.99999999998544808
18 : 121076.999999999985448085
19 : 121076.9999999999854480848