Time limit exceeded- Pattern Code

I am getting correct output without any error in my Code Blocks compiler, but getting time limit exceeded on online IDE.