Powered by Blogger.

Armstrong Program in C++



Armstrong Program in C++ 

Here we will write one of the most important program in C++ which is generally asked in any exam. Armstrong Number Program in C++  or Armstrong Program in C++

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int num,power=0,rem,temp;
cout<<"Enter any three digit number:";
cin>>num;
temp=num;
while(num!=0)
{
rem=num%10;
power+=pow(rem,3);
num=num/10;
}
if(temp==power)
{
cout<<"Armstrong number";
}
else
{
cout<<"Not an Armstrong number";
}
getch();
}

Output: 

Enter any three digit number: 231
Not an Armstrong number



facebook
google-plus
twitter
pinterest

No comments :

Post a Comment

HTML Tutorial

images

About Sitesbay

This blog is related to Java Tutorial, C++ Tutorial, C Tutorial, Online Earning tips and more in very simple and easy way. Here i will try to give complete idea related to all new technology.

Java Tutorial

Java is Object oriented programming language, It is more secure and high performance language.

C++ Tutorial

C++ is also Object oriented programming language, It is more simple and easy to learn.

 
https://sitesbay.blogspot.com/?utm_medium=d2898efa59afcc0bc411921036e22b767ca37b09