Not showing right output

code - https://ide.codingblocks.com/s/233936

in line 10 you need to multiply with p not n.