2026-04-07 17:30:43 +00:00
2026-04-07 17:28:13 +00:00
2026-04-07 17:30:43 +00:00
2026-04-07 17:29:01 +00:00
2026-04-07 17:28:40 +00:00

Week 2 Day 3 Number Analyzer

Project Overview

This project is a JavaScript-based web application that analyzes numbers using loops. It identifies whether numbers are even, odd, and prime, and provides a summary count.

Features

  • Takes user input

  • Generates numbers from 1 to input

  • Identifies:

    • Even numbers
    • Odd numbers
    • Prime numbers
  • Displays total counts

  • Dynamic UI update

Tech Stack

  • HTML5
  • CSS3
  • JavaScript (Vanilla JS)

How It Works

  1. User enters a number

  2. Loop runs from 1 to input

  3. For each number:

    • Even → i % 2 === 0
    • Odd → else
    • Prime → checked using divisor loop
  4. Counters track totals

  5. Output displayed dynamically

Key Concepts Used

  • for loops
  • Nested loops
  • Conditional statements
  • Prime number logic
  • Counters (frequency counting)
  • DOM manipulation

Output Example

Input: 5

1 - Odd 2 - Even | Prime 3 - Odd | Prime 4 - Even 5 - Odd | Prime

Total Even Numbers: 2 Total Odd Numbers: 3 Total Prime Numbers: 3

Future Improvements

  • Optimize prime check (√n method)
  • Add input validation
  • Add reset button
  • Highlight primes with color

Learning Outcome

  • Understanding of loops and nested loops
  • Implementation of mathematical logic
  • Real-world problem solving using JavaScript
  • Efficient use of counters and conditions
Description
No description provided
Readme 27 KiB
Languages
JavaScript 52%
CSS 25.7%
HTML 22.3%