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
defalt branch name
sdefuy6j87uytgraxsd
Quicksort
Collatz Conjecture, using Pi
Print All Cards
Yoo
pyramidnos
Recursion
Program to implement RamaKrishna
Finally statement called after return