Module Module1
Sub Main()
'Dim y As Integer = 10
'While y > 0
' Console.WriteLine("Happy Birthday to you!")
' y = y - 1
'End While
'Dim x As Integer = 0
'While x < 100
' If x Mod 2 = 0 Then 'Mod keeps dividing until there is a remainder
' Console.WriteLine(x)
' End If
' x += 1
'End While
'Console.WriteLine("I have printed out all the " & _
' " even numbers less than 100")
'I want you to print out all the numbers from 5 to 5000
'counting by 5s!
'Count from 3333 to 3 by 3s, going backwards.
Dim counter1 As Integer = 1
Dim stop1 As Integer = 100
'For counter1 = 1 To stop1
' Console.Write("Hello!")
' For a As Integer = 1 To 1000
' Console.Write("Hello!!")
' Next
'Next
'A number is prime if it is only divisible by 1 and itself
'3,5,7...prime numbers never stop
'find out if a number is prime!
'have the user enter in a number..find out if it is a
'prime number ...hint***: You'll need the Mod operator
Dim boolVar1 As Boolean = True
'print out all the prime numbers up to 100!
'Console.WriteLine("Please enter a number")
'Dim numberEntered As Integer = Console.ReadLine
For firstCounter As Integer = 1 To 100
For a As Integer = 2 To (firstCounter / 2) + 1
If firstCounter Mod a = 0 Then
boolVar1 = False
End If
Next
If boolVar1 = True Then
Console.WriteLine(firstCounter & " is a prime number")
End If
boolVar1 = True
Next
Console.ReadLine()
End Sub
End Module
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment