writing loop with goto statement