Day 2 | | JavaScript Math Practice - 10 Exercises with Solutions

Опубликовано: 13 Июнь 2026
на канале: Silent Code Master
17
1

🚀 Lets Practice JavaScript Math together with 10 Practical Exercises! In this hands-on tutorial, I solve 10 real-world JavaScript math problems that every developer should know. From restaurant bills to stock investments, learn how to apply JavaScript to everyday calculations!


🔢 Exercises Covered:

1️⃣ Restaurant Bill Splitter 🏪 - Split $110 among 4
friends
2️⃣ *Smartphone Discount* 📱 - Calculate final price after 15% discount + 8% tax
3️⃣ *Birthday Party Planning* 🎂 - Order total with 10% discount for orders over $100
4️⃣ Fitness Tracker 🏃‍♂️ - Calculate calories burned from running & walking
5️⃣ Stock Investment 📈 - Calculate profit and percentage gain
6️⃣ Pizza Party 🍕 - Split bill with 15% tip among 8 people
7️⃣ Book Store 📚 - Calculate total with tiered shipping costs
8️⃣ Movie Tickets 🎬 - Tuesday discount calculation
9️⃣ Car Rental 🚗 - Calculate total with daily rate, mileage, and insurance
🔟 Home Renovation 🏠 - Calculate materials + labor costs

---

💻 Code Snippets Featured:

```javascript
// Exercise 2: Smartphone Discount
let price = 999;
let discount = price * 0.15;
let discounted = price - discount;
let tax = discounted * 0.08;
let final = discounted + tax;
console.log(`Final price: $${final.toFixed(2)}`);

// Exercise 6: Pizza Party Split
let pizza = 3 * 18;
let soda = 2 * 3;
let subtotal = pizza + soda;
let tip = subtotal * 0.15;
let total = subtotal + tip;
let perPerson = total / 8;
console.log(`Each pays: $${perPerson.toFixed(2)}`);
```


🎯🎯 CORRECTION FOR QUESTION NUMBER 1 🎯 🎯

#1 Restaurant Bill Splitter

You And
🎯3🎯
Friends Have Dinner: $45 For Main Course, $18 For Appetizer, $32 For Drinks, And $15 For Dessert. Calculate The Total Bill And How Much Each Person Pays If Split Evenly.


solution