Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Even-or-odd/Visual-Basic-.NET/even-or-odd-1.vb
Normal file
24
Task/Even-or-odd/Visual-Basic-.NET/even-or-odd-1.vb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Module Module1
|
||||
|
||||
Sub Main()
|
||||
Dim str As String
|
||||
Dim num As Integer
|
||||
While True
|
||||
Console.Write("Enter an integer or 0 to finish: ")
|
||||
str = Console.ReadLine()
|
||||
If Integer.TryParse(str, num) Then
|
||||
If num = 0 Then
|
||||
Exit While
|
||||
End If
|
||||
If num Mod 2 = 0 Then
|
||||
Console.WriteLine("Even")
|
||||
Else
|
||||
Console.WriteLine("Odd")
|
||||
End If
|
||||
Else
|
||||
Console.WriteLine("Bad input.")
|
||||
End If
|
||||
End While
|
||||
End Sub
|
||||
|
||||
End Module
|
||||
30
Task/Even-or-odd/Visual-Basic-.NET/even-or-odd-2.vb
Normal file
30
Task/Even-or-odd/Visual-Basic-.NET/even-or-odd-2.vb
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
Imports System.Numerics
|
||||
|
||||
Module Module1
|
||||
Function IsOdd(bi As BigInteger) As Boolean
|
||||
Return Not bi.IsEven
|
||||
End Function
|
||||
|
||||
Function IsEven(bi As BigInteger) As Boolean
|
||||
Return bi.IsEven
|
||||
End Function
|
||||
|
||||
Sub Main()
|
||||
' uncomment one of the following Dim statements
|
||||
' Dim x As Byte = 3
|
||||
' Dim x As Short = 3
|
||||
' Dim x As Integer = 3
|
||||
' Dim x As Long = 3
|
||||
' Dim x As SByte = 3
|
||||
' Dim x As UShort = 3
|
||||
' Dim x As UInteger = 3
|
||||
' Dim x As ULong = 3
|
||||
' Dim x as BigInteger = 3
|
||||
' the following three types give a warning, but will work
|
||||
' Dim x As Single = 3
|
||||
' Dim x As Double = 3
|
||||
' Dim x As Decimal = 3
|
||||
|
||||
Console.WriteLine("{0} {1}", IsOdd(x), IsEven(x))
|
||||
End Sub
|
||||
End Module
|
||||
Loading…
Add table
Add a link
Reference in a new issue