Write the program form Armstrong no in c++?

Answer Posted / ashish ranjan

#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 ?    13 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a character in c++?

657


Is swift better than c++?

630


Where is atoi defined?

657


What is class and structure in c++?

647


Explain the difference between class and struct in c++?

674






How do you establish an is-a relationship?

706


Are c and c++ similar?

671


How can you tell what shell you are running on unix system?

735


an operation between an integer and real always yeilds a) integer result b) real result c) float result

820


What is the maximum combined length of command line arguments including the space between adjacent arguments?

669


What is the last index number in an array of 100 characters a) 100 b) 99 c) 101

688


What are disadvantages of pointers?

662


Explain the difference between using macro and inline functions?

686


What are static type checking?

716


Will a catch statement catch a derived exception if it is looking for the base class?

636