its not taking a and b value, why?
I strongly discourage the use of program blocks.
The reason c is x when $display executes is because a and b are still x when the initial block in module example executes.
Even if you were to change the initial block to always_comb, the $display still executes before c has a chance to be updated.