Write the program form Armstrong no in c++?

Answer Posted / ramesh

#include<iostream.h>
#include<conio.h>
void main()
{
int sum=0,n,m;
clrscr();
cin>>n;
m=n;
while(n>0)
{
m=n%10;
sum=sum+(m*m*m);
n=n/10;
}
if(m==sum)
{
cout<<"the given number is amstrong";
}
else
{
cout<<"the given number is not amstrong";
}
getch();
}

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How much maximum can you allocate in a single call to malloc()?

633


what is C++ exceptional handling?

627


What is c++ try block?

577


What data encapsulation is in c++?

595


Is c++ vector a linked list?

550






Do class method definitions?

584


What is operator overloading in c++ example?

649


Which operator cannot overload?

541


What is the use of map in c++?

605


What is the use of main function in c++?

524


What is a node class in c++?

642


Can you write a function similar to printf()?

665


What is oops in c++?

587


Refer to a name of class or function that is defined within a namespace?

603


What is constructor and destructor in c++?

617