Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write the program form Armstrong no in c++?

Answer Posted / sarang deshpande

#include<iostream.h>
#include<conio.h>
void main()
{
int n,n1,sum,rem;
clrscr();
cout<<" \n Enter a num ";
cin>>n;
n1=n;
sum=0;
while(n>0)
{
rem=n%10;
sum=sum+(rem*rem*rem);
n=n/10;
}
if(n1==sum)
{
cout<<"\n The number is armstrong "<<n1;
}
else
{
cout<<"\n The number is not armstrong "<<n1;
}
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a multimap c++?

1219


What is a block in c++?

1062


Explain the use of this pointer?

1162


What is the use of map in c++?

1155


Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.

1066


Is main a class in c++?

1012


Name the implicit member functions of a class.

1087


What is the role of copy constructor in copying of thrown objects?

1073


What is a flag in c++?

1069


What does int * mean in c++?

1237


What is the benefit of learning c++?

1004


How we can differentiate between a pre and post increment operators during overloading?

1117


What operators can you overload in c++?

1048


What is c++ coding?

1213


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

1112