Java Program To find A Number is ArmStrong or Not ?

By |2018-03-21T21:56:19+05:30June 22nd, 2016|java programs|

Here we are going to write a program to check a number is ArmStrong or not ?

Number is ArmStrong or not ?

import java.util.Scanner;

public class ArmStrongNumber {

    public static void main(String a[]) {

        int remainder, dividor, sum = 0;
        Scanner sc = new Scanner(;
        System.out.println("Enter a Number");
        int input = sc.nextInt();
        int temp = input;

        while (input > 0) {
            remainder = input % 10;
            input = input / 10;
            sum = sum + (remainder * remainder * remainder);
        if (sum == temp) {
            System.out.println("ArmStrong Number");
        } else {
            System.out.println("Not an ArmStrong Number");


Output :

Enter a Number 371
ArmStrong Number
Enter a Number 180
Not an ArmStrong Number

Happy Learning 🙂

About the Author:

Hi Folks, you have reach this so far, that shows you like what you are learning. Then why don't you support us to improve for bettor tutorials by leaving your valuable comments and why not you keep in touch with us for latest updates on your favorite blog @ facebook , twitter , Or Google+ ,

Leave A Comment