This is your program with a few wrinkles. It runs fine, but you have NO logic to change the float, or the integer, into a hexadecimal number.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
union
{
int a;
float b;
}myUnion;
printf("Enter the Decimal number to be converted:\n");
scanf("%f",&myUnion.b);
printf("The float number in base 10 is: %f, and in Hexadecimal is: %x\n", myUnion.b, myUnion.a);
printf("%d",(int) myUnion.b); //NOTE the cast to an int
while((myUnion.a = getchar()) != '\n'); //these two lines work to hold the console window open
myUnion.a = getchar();
return 0;
}