randomposts
Powered by Blogger.

ARMSTRONG number C++ Program Code

No comments




include<iostream.h>
include<stdio.h>
include<conio.h>

class test
{
            private:
                        int n,a,b,s;

            public:
                        void getdata()
                        {
                                    cout<<"\n\n\n  -> Enter The Number:- ";
                                    cin>>n;

                                    s=0;
                                    b=n;
                        }

                        void putdata()
                        {
                                    while(n>=1)
                                    {
                                                a=n%10;
                                                s=s+(a*a*a);
                                                n=n/10;
                                    }

                                           // cout<<"\n     Your Revers Number Of:- ";
                                                //cout<<s;

                                    if(b==s)
                                    {
                                                cout<<"\n\n     This Is Armstrong Number are ";
                                    }
                                    else
                                    {
                                                cout<<"\n\n  this  Number is not  Armstrong Number are ";
                                    }
                        }
            };

                        void main()
                        {
                                    clrscr();
                                    test t1,t2,t3;
                                    t1.getdata();
                                    t1.putdata();
                                    t2.getdata();
                                    t2.putdata();
                                    t3.getdata();
                                    t3.putdata();

                           getch();
                        }

 Thanks & Regards
  -Yagnik Gorasiya

Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).

No comments :

Post a Comment