[ create a new paste ] login | about

Link: http://codepad.org/0uen3jYg    [ raw code | output | fork ]

C++, pasted on Nov 2:
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

int main(){
    float a = 0.001f, x = 1.0f;
    //std::cin >> a;
    while(x > a){
        x /= 2;
        std::cout << x << std::endl;
    }
    return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
0.5
0.25
0.125
0.0625
0.03125
0.015625
0.0078125
0.00390625
0.00195312
0.000976562


Create a new paste based on this one


Comments: