Can someone help me solve this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone help me solve this

This is a code to solve the Joseph flavius problem in c# using System; public class Program { public static void Main() { int entrada = 0, potencia = 2, resultado = 0; Console.WriteLine("Ingrese el total de personas"); entrada = Convert.ToInt32(Console.ReadLine()); for (int i = 1; i < entrada; i++) { potencia = potencia * 2; } for (int i = 0; i <= potencia; i++) { potencia -= 1; if (i >= entrada) { i = 0; } else if (potencia <= 0) { Console.WriteLine(

quot;La posicion que sobrevive es la: {i}"); } } Console.ReadLine(); } }

1st Oct 2023, 9:24 PM
Bernardo Nolasco
2 Answers
+ 3
Hint: The question is how you want / should solve this task, in mathematicaly or program algorithmicaly way? There are a few mathe solutions, for them you can search in web if you cannot it solve yourself. Or you try to solve it with arrays / lists where are ones and zeros to manage.
2nd Oct 2023, 8:24 AM
JaScript
JaScript - avatar
2nd Oct 2023, 7:46 PM
Siyamend Abde
Siyamend Abde - avatar