Module Module1
Sub Main()
Dim counter As Integer
'add another variable!
Dim diff As Integer = 1
Dim totalFactors As Integer = 0
Dim factorCounter As Integer
For counter = 1 To 60000
'Console.WriteLine(counter)
For factorCounter = 1 To counter
If counter Mod factorCounter = 0 Then
totalFactors = totalFactors + 1
End If
Next
If totalFactors > 50 Then
Console.WriteLine(counter)
End If
counter = counter + diff
diff = diff + 1
totalFactors = 0
Next
'1, 3, 6, 10, 15, 21, 28
'print out the first 10 triangle numbers!
Console.ReadLine()
End Sub
End Module
Saturday, January 31, 2009
On your blog...
Please explain...
- What an if statement is and what it is used for.
- What a loop is and what it is used for.
Put a code example on your blog. What is the syntax for each!
Saturday, January 24, 2009
First code in VB .NET!
Module Module1
Sub Main()
'to make a variable ... Dim variable1 As
'Console write line!
'Console read line!
'This is a comment. You use comments so other programmers
'can know what you mean!!
'Miles Per Gallon Calculator!
Dim miles As Decimal
Dim gallons As Decimal
Dim mpg As Decimal
Console.WriteLine("Please enter the distance in miles:")
miles = Console.ReadLine
Console.WriteLine("Please enter the gallons used:")
gallons = Console.ReadLine
' We need to calculate the miles per gallon!
mpg = miles / gallons
Console.WriteLine(mpg)
'Console.ReadLine()
'to see if we have the correct information
'100 miles / 10 gallons of gas -> 10 mpg
End Sub
End Module
Sub Main()
'to make a variable ... Dim variable1 As
'Console write line!
'Console read line!
'This is a comment. You use comments so other programmers
'can know what you mean!!
'Miles Per Gallon Calculator!
Dim miles As Decimal
Dim gallons As Decimal
Dim mpg As Decimal
Console.WriteLine("Please enter the distance in miles:")
miles = Console.ReadLine
Console.WriteLine("Please enter the gallons used:")
gallons = Console.ReadLine
' We need to calculate the miles per gallon!
mpg = miles / gallons
Console.WriteLine(mpg)
'Console.ReadLine()
'to see if we have the correct information
'100 miles / 10 gallons of gas -> 10 mpg
End Sub
End Module
What are possible attributes and methods for a Lemonade Stand?
On a blog,
http://www.blogger.com/
I'd like you to list the possible attributes and methods for a Lemonade stand.
When you are finished with your blog, I'd like you to email me the URL.
You may work with someone next to you!
I'd also like you to include the data type for your attributes:
http://www.ondotnet.com/pub/a/dotnet/2001/07/30/vb7.html
DF
http://www.blogger.com/
I'd like you to list the possible attributes and methods for a Lemonade stand.
When you are finished with your blog, I'd like you to email me the URL.
You may work with someone next to you!
I'd also like you to include the data type for your attributes:
http://www.ondotnet.com/pub/a/dotnet/2001/07/30/vb7.html
DF
- What's your name?
- What sort of programming experience do you have?
- What are you interested in getting out of this class?
- Is this class for your job or personal reasons?
Subscribe to:
Posts (Atom)