Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
1
Remove dublicates
Use ConcurrentQueue and ConcurrentDictionary with TPL (Simple example)
a
Sort A List : Print the sorted list of ages of the students
Kopia
ö1
Events
-Wall -std=c++14 -O0 -o a.out source_file.cpp
Login Silencioso
Please log in to post a comment.