Print prime numbers upto n

https://ide.codingblocks.com/#/s/24753
please see what is wrong with this code.I want to print all prime numbers upto n.

https://ide.codingblocks.com/#/s/24809

See this code.
It prints prime numbers upto n.