Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Collatz Conjecture
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { int i = int.Parse(Console.ReadLine()); int loops = 0; Console.WriteLine(i); while(i>1){ if(i%2==0){ i=i/2; } else{ i=i*3+1; } Console.WriteLine(i); loops++; } Console.WriteLine(loops + " loops"); } } }
run
|
edit
|
history
|
help
0
Scope variables
newDiv2by1
SDAXXX
PassByValue vs PassByRerefence
Fórum ➡ GroupJoin ➡ Join ➡ Easily ‼
a6
Home work3 finding Min and Max (to theGit)
Testing 001
triangular matrix
I know it's a bit combersome, but it's my first attempt.