
An Armstrong number is defined to be an integer where the sum each digit raised to the power of the number of digits in the number equals the number itself. Haha. Sound confusing? Well here is are two examples:

My program to find these numbers:
Surprisingly this only took 53 lines of code... It can be done in less.

The output:
Here are all Armstrong numbers from 1 to 100,000
1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084
If you want to try out the raw code yourself you can go to browxy.com or codiva.io and copy/paste this:
class Armstrong {
// This is the main class. It runs the program.
public static void main(String[] args) {
AllArmstrongNumbers(1,100000);
}
// This prints out all Armstrong numbers from 1st to 2nd argument.
public static void AllArmstrongNumbers(int min, int max) {
boolean ANum;
for (int i = min; i <= max; i) {
ANum = isArmstrong(i);
if (ANum == true) {System.out.print(i + " ");}
}
}
// This counts the number of digits in a number.
public static int digitCount(int n) {
int count = 0;
while(n != 0) {
n = n / 10;
count;
}
return count;
}
// This is an exponent calculator.
public static int power(int base, int exponent) {
int summ = base;
for(int i = 1; i < exponent; i){
summ = summ*base;
}
return summ;
}
// This finds out if a number is Armstrong.
public static boolean isArmstrong(int num) {
int remainder;
int exp = digitCount(num);
int originalNumber = num;
boolean ArmstrongNumber;
int summ = 0;
for (int i = 1; i <= exp; i) {
remainder = num % 10;
summ = summ + power(remainder,exp);
num = num / 10;
}
if (summ == originalNumber) {ArmstrongNumber = true;}
else {ArmstrongNumber = false;}
return ArmstrongNumber;
}
}

All SteemitEducation Posts
Physics
Kinematics Video, Circular Motion Video, Forces in 1 & 2 Dimensions Videos, Kinematics Full Lesson, Circular Motion and Gravitation Full Lesson, Kinematics and Forces Quiz, Forces in 1-Dimension, Forces in 2-Dimensions, Basic Physics, Kinematics, and Forces Review, AP Physics Midterm Exam, AP Physics Midterm Exam Solutions , Kinematics and Forces Quiz
Computer Science
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
SAT
Asymptotes, Composite Functions, Contest 1 - Area, Contest 1 – Winners and Solution, PEMDAS, Systems of Equations, Functions, Exponents, Contest 2 - More Functions, Contest 2 – Winners and Solution, Percents, The Interest Equation, All About Division, Contest 3 - Factoring, Contest 3 – Winners and Solution, Fractional and Negative Exponents, Basic Trig, Contest 4 - Math Vocab, Contest - 5, Contest 5 – Winners and Solution, Contest 6, Contest 6 – Winners and Solution
General Math
Basics of Algebra, Trigonometry Video, Proof of Quadratic Formula, Factoring Video, Unions and Intersections, Surface Area of a Cylinder, Substitution Video, Combinatorics Basics
Graphing from Algebra to Calculus
Algebra 1, Algebra 2, Pre-Calculus, Calculus
Piloting Airplanes
Introduction, Preflight, Requirements, Instruments, Take-Offs and Landings, Why a Plane Can Fly, Reading the Runway, Maneuvers
Other
Engineering (Isometric) Drawing, Pressure & SCUBA Diving


