#include <stdio.h>
#include <math.h>
char
separate (double number, int *w, double *f)
{
char s;
double magnitude;
if (number < 0)
s = '-';
else if (number == 0)
s = ' ';
else
s = '+';
magnitude = fabs (number);
*w = floor (magnitude);
*f = magnitude - *w;
return (s);
}
int
main (void)
{
double n;
char sign;
int whole;
double fraction;
printf ("Enter a real number: ");
scanf ("%lf", &n);
sign = separate (n, &whole, &fraction);
printf ("Parts of %f: \n", n);
printf ("===============\n\n");
printf ("Sign is: %c \n", sign);
printf ("Whole part is %d \n", whole);
printf ("Fraction part is %f \n", fraction);
return (0);
}