Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
The 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[] result = new int[1000]; //Your code goes here int num = int.Parse(Console.ReadLine()); Console.WriteLine(num); for (int i = 0; num > 1; i++) { if (num % 2 == 0) { result[i] = num / 2; } else { result[i] = num * 3 + 1; } num = result[i]; Console.WriteLine(num); } } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
6
Convert Excel Range To Absolute Excel Range
unix practice - santhosh
type comparison
AAAXACAdxcd
JJ 2
Simple Constructor Implementation
Intuit // C# // listing_4.11 (break // ryad Teylora..)
Irfan_Problem
Game_snake
Please log in to post a comment.