SHARE
TWEET

Simplest Impossible Problem

jorritminkes Jan 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Threading
  2. Module Module1
  3.  
  4.     Sub Main()
  5.         Dim Input As Integer = Console.ReadLine
  6.         Dim Current As Integer
  7.         Dim aantalTurns As Integer = 0
  8.         Current = Input
  9.  
  10.         While Current <> 1
  11.             If Current Mod 2 = 0 Then
  12.                 Current = Current / 2
  13.                 aantalTurns += 1
  14.                 Console.WriteLine(Current)
  15.             ElseIf Current Mod 2 <> 0 Then
  16.                 Current = 3 * Current + 1
  17.                 aantalTurns += 1
  18.                 Console.WriteLine(Current)
  19.             End If
  20.         End While
  21.         'aantalTurns = aantalTurns + 1
  22.         Dim turns As String
  23.         If aantalTurns > 1 Then
  24.             turns = "turns"
  25.         Else
  26.             turns = "turn"
  27.         End If
  28.         Console.WriteLine("This took " & aantalTurns & " " & turns)
  29.  
  30.         Thread.Sleep(123456789)
  31.     End Sub
  32.  
  33. End Module
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top