Create a Code To Check Number is Armstrong Or Not. With Use of Scope Resolution Operator Using C++

#include<iostream.h>
#include<conio.h>

class second
{
  private:
       int no;
  public:
       void Enter_No();
       void Check_armstrong();
};
void second :: Enter_No()
{
  cout<<"\nEnter Number for Check Armstrong or Not:->";
  cin>>no;
}
void second :: Check_armstrong()
{
  int a,s=0,b;
  b=no;
  while(no>=1)
  {
    a=no%10;
    s=s+(a*a*a);
    no=no/10;
  }
  if(s==b)
  {
    cout<<"\nThe Number is Armstrong";
  }
  else
  {
    cout<<"\nThe Number is Not Armstrong";
  }
}
void main()
{
  clrscr();
  second s1;
  s1.Enter_No();
  s1.Check_armstrong();
  getch();
}
Create a Code To Check Number is Armstrong Or Not. With Use of Scope Resolution Operator Using C++ Create a Code To Check Number is Armstrong Or Not.  With Use of Scope Resolution Operator Using C++ Reviewed by Unknown on 6:02:00 PM Rating: 5

No comments:

Powered by Blogger.