Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace 3n_1CSharp
- {
- class Program
- {
- static void Main()
- {
- int n, i = 0;
- n = Console.Read();
- while (n != 1)
- {
- i ++;
- if ((n % 2) != 0)
- {
- n = n * 3 + 1;
- }
- else
- {
- n = n / 2;
- }
- }
- Console.WriteLine(i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement