Skip to content

Commit

Permalink
Create Armstrong number
Browse files Browse the repository at this point in the history
  • Loading branch information
Prophet08 authored Oct 7, 2020
1 parent a1069e6 commit b3c9175
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Java/Armstrong number
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class ArmstrongExample{
public static void main(String[] args) {
int c=0,a,temp;
int n=153;//It is the number to check armstrong
temp=n;
while(n>0)
{
a=n%10;
n=n/10;
c=c+(a*a*a);
}
if(temp==c)
System.out.println("armstrong number");
else
System.out.println("Not armstrong number");
}
}

0 comments on commit b3c9175

Please sign in to comment.