Armstrong Number in Java with Example | Java Basics

preview_player
Показать описание
✅ In this video, we will learn how to write a Java program to check whether a number is an Armstrong number or not. This is a common question in Java programming interviews and exams. Perfect for beginners and those preparing for Java coding practice.

📌 Topics Covered:

What is an Armstrong Number?

Logic behind Armstrong Number in Java

Simple program with explanation

Example: 153, 370, 371, 407

📘 Definition:
An Armstrong number is a number that is equal to the sum of cubes of its digits.
Example:
153 = 1³ + 5³ + 3³ = 1 + 125 + 27 = 153

👨‍💻 Java Code Used in the Video:

java
Copy
Edit
class ArmstrongCheck {
public static void main(String[] args) {
int num = 153, digit, sum = 0;
int temp = num;

while (num != 0) {
digit = num % 10;
sum += digit * digit * digit;
num /= 10;
}

if (sum == temp)
else
}
}
🌟 Don’t forget to Like, Share, and Subscribe for more Java tutorials in Telugu!

📺 Channel: Computer Science Telugu
Рекомендации по теме
welcome to shbcf.ru