Initial Commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user