Skip to content

Instantly share code, notes, and snippets.

@SiddharthManthan
Created August 9, 2022 16:41
Show Gist options
  • Save SiddharthManthan/b8ca506b5e071c88f7a56ddf2391f0d0 to your computer and use it in GitHub Desktop.
Save SiddharthManthan/b8ca506b5e071c88f7a56ddf2391f0d0 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class ArmStrongNumber {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int result=0;
int sum=0;
int num=0;
int cube=0;
int temp=0;
temp=n;
while(temp>0) {
num=temp%10;
cube=num*num*num;
sum=sum+cube;
temp=temp/10;
}
if(sum==n) {
result=1;
}
System.out.println(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment