๐Ÿ“… Date: Jan 30, 2026
๐Ÿ”ฅ Topic: Logic Building: Armstrong Number


๐Ÿ’ช What is an Armstrong Number?

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 (Matched!)

๐Ÿงฉ The Algorithm

To code this, I need to extract digits one by one.

  1. Get last digit using Modulo (num % 10).
  2. Cube it and add to Sum.
  3. Remove last digit using Division (num / 10).
  4. Repeat until num becomes 0.

๐Ÿ’ป Day 30 Code

#include <iostream>
using namespace std;

int main() {
    int n, originalNum, remainder, result = 0;
    cout << "Enter an integer: ";
    cin >> n;
    
    originalNum = n; // Backup the number

    while (originalNum != 0) {
        // remainder is the last digit
        remainder = originalNum % 10;
        
        // Add cube to result
        result += remainder * remainder * remainder;
        
        // Remove last digit
        originalNum /= 10;
    }

    if (result == n)
        cout << n << " is an Armstrong number.";
    else
        cout << n << " is NOT an Armstrong number.";

    return 0;
}

๐ŸŽ‰ Month 1 Complete!

It's been 30 days of consistent coding. From "Hello World" to solving mathematical problems, the journey has been insane.

⏭️ Next Chapter: Bit Manipulation
Next month, I'm diving into the binary magic of Bit Manipulation (XOR, AND, OR tricks) which is a superpower in competitive programming.
Stay Tuned!