16 lines
330 B
C
16 lines
330 B
C
#include <stdio.h>
|
|
void decompose(double, long *, double *);
|
|
|
|
int main() {
|
|
long mp;
|
|
double rm;
|
|
double x = 3.141234;
|
|
printf("%ld, %f\n", mp, rm);
|
|
decompose(x, &mp, &rm);
|
|
printf("%ld, %f\n", mp, rm);
|
|
}
|
|
|
|
void decompose(double x, long *int_part, double *frac_part) {
|
|
*int_part = (long)x;
|
|
*frac_part = x - *int_part;
|
|
}
|