Random query problem

why it is not accepted and what is wrong ?

Please share your code via ide.codingblocks.com so that i can have a look.
Meanwhile Please have a look at this short snippet.
https://ide.codingblocks.com/s/155700