Code:
Module Module1
Sub Main()
Dim num, temp, r, s, t As Integer
Console.WriteLine(" Armstrong Number Between 1 to 500: ")
For num = 1 To 500
temp = num
s = 0
For t = 0 To num
r = temp Mod 10
s = (r * r * r) + s
temp = temp \ 10
Next
If num = s Then
Console.WriteLine(num)
End If
Next
Console.ReadKey()
End Sub
End Module
Module Module1
Sub Main()
Dim num, temp, r, s, t As Integer
Console.WriteLine(" Armstrong Number Between 1 to 500: ")
For num = 1 To 500
temp = num
s = 0
For t = 0 To num
r = temp Mod 10
s = (r * r * r) + s
temp = temp \ 10
Next
If num = s Then
Console.WriteLine(num)
End If
Next
Console.ReadKey()
End Sub
End Module
Output:
1 Comments:
Click here for CommentsVery good programming technique for remember