Write the program form Armstrong no in c++?

Answer Posted / roshan patel

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x,y,d;
cout<<"\nEnter the no : ";
cin>>x;
y=x;
int sum=0;
while(y>0)
{
d=y%10;
y/=10;
sum=sum+d*d*d;
}
if(x==sum)
cout<<"\n "<<x<<" is Armstrong ";
else
cout<<"\n"<<x<<" is not Armstrong";
getch();
}

Is This Answer Correct ?    17 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can non-public members of another instance of the class be retrieved by the method of the same class?

692


Is c++ a software?

809


What are the various compound assignment operators in c++?

628


Does c++ vector allocate memory?

630


What are c++ data types?

734






What is class invariant in c++?

842


How do you remove an element from a set in c++?

683


How can I improve my c++ skills?

662


What is virtual table?

719


Is c++ a good first language to learn?

660


Can we use struct in c++?

694


Write a program to interchange 2 variables without using the third one.

675


Explain Text Manipulation Routines?

724


Name the operators that cannot be overloaded in C++?

688


What is set in c++?

745