프로그래밍언어/VB.NET
1부터 10까지 숫자 제곱구하기
부산딸랑이
2013. 7. 4. 18:53
출처 : MSDN
' Generate a sequence of integers from 1 to 10
' and project their squares.
Dim squares As IEnumerable(Of Integer) = _
Enumerable.Range(1, 10).Select(Function(x) x * x)
Dim output As New System.Text.StringBuilder
For Each num As Integer In squares
output.AppendLine(num)
Next
' Display the output.
MsgBox(output.ToString())
' This code produces the following output:
'
' 1
' 4
' 9
' 16
' 25
' 36
' 49
' 64
' 81
' 100