main()
{
if()
{
   if()
    {
     if()
      {
          something ()
        /* something so that the program executes the last line means last printf without using goto ststement */
       }
     }
  }
printf("hello");
}

Homework detected, even though you haven't asked a question yet.

If this were real code, I'd say go ahead and use goto. The reasons to avoid doing so don't really apply in this particular situation, and it saves time, space and clutter.

If this were real code, I'd say go ahead and use goto.

If this were real code, I'd say that it should probably be refactored into multiple functions rather than straight nested conditionals. Though I can't help but notice that there's not a loop in the example cod in the first place. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.