Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 358678c

Browse files
committed
Challenge_19
Signed-off-by: Harshit_Dongre <95414266+Harshit1020@users.noreply.github.com>
1 parent fb8e677 commit 358678c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.Scanner;
2+
3+
public class ArmstrongNum {
4+
public static void main(String[] args) {
5+
int n;
6+
Scanner sc = new Scanner(System.in);
7+
System.out.println("enter the value:");
8+
n = sc.nextInt();
9+
int temp = n;
10+
int rem, sum =0;
11+
while(n >0){
12+
13+
rem = n%10;
14+
sum = sum+(rem*rem*rem);
15+
n = n/10;
16+
}
17+
if(temp == sum){
18+
System.out.println("number is armstrong");
19+
}
20+
else{
21+
System.out.println("number is not armstrong");
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)