Are you sure that the the reason that there is no output isn't in fact because you invoked undefined behaviour by declaring main as returning void?
main returns int, always, without exception. To do otherwise invokes undefined behaviour.
Undefined behaviour is exactly what it says, once invoked in anyway the behaviour of the program is completely undefined. The program may do anything including formatting your hard disk, although results are normally less drastic but often still a disaster for the program. You should always avoid invoking undefined behaviour.
OK onto your observed behaviour, the statement
the following program does not give any output supposedly becoz a double const is being assigned to a float variable
is wrong. This is not the reason that the program does not give any output.
You are getting warnings about assigning a double constant to a float variable because that is what you are doing on lines 3 and 7 of your program.
C has 2 floating point types float and double these have different precisions, often 7 and 15 significant digits, and are held in a different number of bytes, often 4 and 8 bytes respectively.
That means that when you assign a double (variable or constant) to a float variable the compiler has to truncate the value, that is convert it to the new format and you loose precision.
1.1
.1
1e-3
are all examples of double constants, if you want a float constant you have to
tack an f on the end
1.1f
.1f
1e-3f
If you do this for all double constants in your program then it will apparently fix the behaviour and you will get output (probably).
However there is another problem. You are using a float variable (x) as a control variable, that is you are using it in an if, while or for condition.
This is very poor practice because as i mentioned earlier a float holds 7 significant digits (and a double 15). But they can hold a vast range of values from very large to very small. The reason they can do this is that they actually only hold approximations to the number in question.
Because the value held is an approximation trying to test it against a specific value is almost bound to fail at sometime.
You should absolutely never use the comparisons == and != with float and double variables and you should only use <, <=, > and >= with very great care and in the knowledge that it is possible to get cases that when worked out on paper produce one result but that the computer will come up with the inverse.