Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

100men r standing in circle.No.1 has sword.He kills next man nd give sword to next(3rd).Every1 does same.Plz giv C prog. to find who survive?

1 Answer

Relevance
  • Jack
    Lv 7
    3 years ago
    Favorite Answer

    Start by understanding the problem. Can you put an equation to it? If you can, then you just have to "translate" that to a c program that will likely involve a loop? It wouldn't have to involve a loop. But that's an easy way to do it. You can always use the equation directly instead of looping. The 100 men would give you a clue as to how many times to loop. Each time a man dies, you remove a number from the loop.

    Do you stop when you get to the original man? Or do you continue until only one man is left? It makes a difference. How do you identify the men? Do they each get a number or a name?

Still have questions? Get your answers by asking now.