Skip to content

Commit 1f496ec

Browse files
authored
Armstrong file
1 parent d4f6b3d commit 1f496ec

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Armstrong.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class ArmstrongExample{
2+
public static void main(String[] args) {
3+
int c=0,a,temp;
4+
int n=153;//It is the number to check armstrong
5+
temp=n;
6+
while(n>0)
7+
{
8+
a=n%10;
9+
n=n/10;
10+
c=c+(a*a*a);
11+
}
12+
if(temp==c)
13+
System.out.println("armstrong number");
14+
else
15+
System.out.println("Not armstrong number");
16+
}
17+
}

0 commit comments

Comments
 (0)