[ create a new paste ] login | about

Link: http://codepad.org/kPGKtcZi    [ raw code | output | fork | 1 comment ]

C, pasted on Mar 20:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    double integral;
    double fractional;

    fractional = modf(123.4567, &integral);

    printf("%f\n", integral);
    printf("%f\n", fractional);

    return EXIT_SUCCESS;
}


Output:
1
2
123.000000
0.456700


Create a new paste based on this one


Comments:
posted by limcoder on Apr 10
<math.h> is required
reply