Guess D Amstrong Number !!

Amstrong Number !

156 100 153 89

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Abc Def
Apr 28, 2014

An Armstrong number is a number, sum of cubes of whose digits is equal to the number itself i.e. If the number is ab then (a^3)+(b^3)=ab By the options it's pretty obvious that the correct option is 153 and you don't need to know Computer Science for the question. Because 1^3 + 5^3 + 3^3 =153

Sanjay Kamath
Apr 21, 2014

Here is my code in C#..

    Here is the subroutine....

    private bool GetNo_(int a)
    {
        int b, c, d, e;
        double f;

        b = 0;
        c = 0;
        d = 0;
        e = 0;
        f = 0;

        b = a % 10;
        c = a / 10;
        d = c % 10;
        e = c / 10;

        f = Math.Pow(b, 3) + Math.Pow(d, 3) + Math.Pow(e, 3);

        if (a == f)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

        Here is the calling routine..

        ArrayList ar = new ArrayList();

        ar.Add(100);
        ar.Add(156);
        ar.Add(89);
        ar.Add(153);

        bool IsArmstrongNo = false;

        for (int r = 0; r < ar.Count; r++)
        {
            IsArmstrongNo = GetNo_(int.Parse(ar[r].ToString()));

            if (IsArmstrongNo == true)
            {
                MessageBox.Show(ar[r].ToString() + " is an Armstrong number.");
                break;
            }
        }

       Answer : 153
Agis Nulhakim
Mar 21, 2014

Just try that code

Didnt try it...already knew!!

Tanya Gupta - 7 years, 2 months ago

Log in to reply

you have solved it before ? or how did you knew ?

Harsh Khatri - 7 years, 1 month ago

Log in to reply

Well...I had taken CS(Computer Science) in 10th....so in BlueJ, we had a code that ran along the same lines....luckily ,.I remembered that :)

Tanya Gupta - 7 years, 1 month ago

Log in to reply

@Tanya Gupta wow the same, i just knew it and mastered the code in C#

Mardokay Mosazghi - 6 years, 11 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...