Armstrong Number between 100-999 in Java

An Armstrong number is the one whose value is equal to the sum of the cubes of its digits. Armstrong Number is a positive number if it is equal to the sum of cubes of its digits is called Armstrong number and if its sum is equal to the number then its a Armstrong number using for if statement. The if statement is the most basic of all the control flow statements. It tells your program to execute a certain section of code only if a particular test evaluates to true. The if statement is written with the if keyword, followed by a condition in parentheses, with the code to be executed in between curly brackets. Armstrong Number Program is very popular in java.

Source Code

public class Armstrong_Numbers {
    //Write a program to find the armstrong number from 100-999
    public static void main(String[] args)
        int digit1,digit2,digit3,result,temp;
        for(int number = 100; number <= 999; number++)
            temp = number;
            result=(digit1 * digit1 * digit1)+( digit2 * digit2 * digit2)+(digit3 * digit3 * digit3);
                System.out.println(number + " is armstrong Number");


153 is armstrong Number
370 is armstrong Number
371 is armstrong Number
407 is armstrong Number
To download raw file Click Here

Basic Programs