Try this:
@Ankit003 https://ide.codingblocks.com/s/262276 still getting WA
loop upto n in every for loop