using conitional while printing upper barrier