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?

Jack2018-02-08T04:20:32Z

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?