[ create a new paste ] login | about

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

C++, pasted on May 21:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <cmath>
 
using namespace std;
 
void degree( double value ) {
    if ( value < 0 )
        cout << ceil( log10( value ) ) << endl;
    else
        cout << floor( log10( value ) ) << endl;
 
}
 
int main()
{
    degree( 316.22776601683793319988935444327 );
    degree( 425 );
    return 0;
}


Output:
1
2
2
2


Create a new paste based on this one


Comments: