Run Code
|
API
|
Code Wall
|
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
NumsToVars
Min max elements swap of the array
merge 2 arrays
Masking Credit Card Number
Пример применения необязательных аргументов
test1
Symantic check for object type variables
asxs
Preprocessor in C# (#define and conditional operatives)
temp_with_pow