A fun, interactive number trick that feels like magic β built using HTML, CSS, and JavaScript.
Perfect for teaching kids (ages 10β15) basic arithmetic and programming logic with a touch of mystery!
The user inputs a number, and the app walks them through a step-by-step animated puzzle:
- Adds the same number again.
- Adds 10 to the total.
- Takes half of the result.
- Subtracts the friendβs part.
- Reveals the magical number: always 5!
This trick always ends up with the number 5 β no matter what number is entered β making it feel magical while reinforcing math logic!
Math Concepts:
- Addition
- Division
- Variables
- Logic
Programming Concepts:
- Input/output handling in JavaScript
- Delays with async/await
- CSS transitions and animations
- DOM manipulation
Great for classroom demos, coding workshops, or learning projects for students aged 10 to 15.
- Open https://srijandev145.github.io/magic-number-5/ in any modern web browser.
- Enter a number in the input field.
- Click Start Magic!
- Watch the animated steps reveal the logic of the puzzle.
- HTML: Structure
- CSS: Styling and animations
- JavaScript: Logic, interactivity, async flow
Feel free to fork, star, or contribute!