Skip to content

Commit

Permalink
Merge pull request #87 from Meghna2080/master
Browse files Browse the repository at this point in the history
Created Check_armstrong_number.cpp
  • Loading branch information
fineanmol committed Oct 17, 2020
2 parents 96add13 + 328bd1c commit fa6c3c0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions Contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ <h1 class="animated rubberBand delay-4s">Contributors</h1>
<a class="box-item" href="https://github.com/satyampgt4"><span>Satyam</span></a>
<a class="box-item" href="https://github.com/vikramadityasinghs"><span>Vikramaditya Singh Saxena</span></a>
<a class="box-item" href="https://github.com/Aashu23"><span>Aashu</span></a>
<a class="box-item" href="https://github.com/Meghna2080"><span>Meghna Singh</span></a>


<!--
Expand Down
28 changes: 28 additions & 0 deletions Program's_Contributed_By_Contributors/Check_armstrong_number.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include<iostream>
#include<math.h>
using namespace std;

int main()
{
int n,temp,remainder,x=0,ans=0;
cout<<"Enter a number:"<<endl;
cin>>n;
temp=n;
while(temp!=0){
temp=temp/10;
x++;
}
temp=n;
while(temp!=0)
{
remainder=temp%10;
int power=round(pow(remainder,x));
ans+=power;
temp=temp/10;
}
if(ans==n)
cout<<"Armstrong number";
else
cout<<"Not an armstrong number";
return 0;
}

0 comments on commit fa6c3c0

Please sign in to comment.