Pages

Search This Blog

Find Armstrong Number between 1 to 2000


Module Find_ArmNum
    Sub Main()
        Dim r, sum, t, max, min As Integer

        min = 1
        max = 2000
        Console.WriteLine("Armstrong Numbers are:- ")
        While min <= max
            t = min
            sum = 0
            While t <> 0

                r = t Mod 10
                sum += Math.Pow(r, 3)
                t = t \ 10
            End While

            If sum = min Then

                Console.WriteLine(min.ToString())
            End If
            min += 1

        End While
        Console.ReadLine()
    End Sub

End Module

6 comments:

  1. Hiya! How do you personally think, have your writting skills gone any better lately?

    ReplyDelete
    Replies
    1. Writing skills improve through practice and experience.I am still learning.So its too early to say whether my writing skill have improve or not.But it will surely do one day :)

      Delete
  2. Plzz upload each programs output ...

    ReplyDelete
  3. can u please send same program using for loop?

    ReplyDelete