Files
collatz-conjecture/CollatzConj/Program.cs
T
2025-08-01 13:46:07 -04:00

37 lines
779 B
C#

using System;
using System.Runtime.InteropServices;
namespace CollatzConj
{
class Program
{
static void Main(string[] args)
{
for (int i = 1; i <= 100; i++)
{
int x = i;
do
{
Console.Write(x + " -> ");
if (x % 2 == 0)
{
x = x / 2;
}
else if (x % 2 == 1)
{
x = 3 * x + 1;
}
//Console.Write("HELLO GRRRRANT! ");
} while (x != 1);
Console.WriteLine("1");
Console.WriteLine();
}
}
}
}