chamsi09

Untitled

Nov 14th, 2024
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.46 KB | None | 0 0
  1. Module Module1
  2.     Sub Main()
  3.         Dim result As Integer = CountDown(10)
  4.         Console.WriteLine("Result: " & result)
  5.     End Sub
  6.  
  7.     Function CountDown(n As Integer) As Integer
  8.         ' Base case: when n equals 0, return 0
  9.         If n = 0 Then
  10.             Return 0
  11.         Else
  12.             ' Recursive case: but we mistakenly increment n instead of decrementing
  13.             Return CountDown(n + 1)
  14.         End If
  15.     End Function
  16. End Module
  17.  
Advertisement
Add Comment
Please, Sign In to add comment