Skip to content

Commit eb9a030

Browse files
authored
Create Armstrong number
1 parent 68c9cd1 commit eb9a030

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Armstrong number

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

0 commit comments

Comments
 (0)