.calc-title { text-align: center; color: #2c3e50; margin-bottom: 25px; font-size: 28px; font-weight: 700; }
.calc-row { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; }
.fraction-box { display: flex; flex-direction: column; align-items: center; }
.fraction-input { width: 70px; padding: 10px; border: 2px solid #3498db; border-radius: 6px; text-align: center; font-size: 18px; outline: none; transition: border-color 0.3s; }
.fraction-input:focus { border-color: #2980b9; }
.divider { width: 100%; height: 2px; background-color: #333; margin: 5px 0; }
.operator { font-size: 32px; font-weight: bold; color: #7f8c8d; }
.whole-number-box { display: flex; flex-direction: column; align-items: center; }
.whole-input { width: 90px; padding: 20px 10px; border: 2px solid #2ecc71; border-radius: 6px; text-align: center; font-size: 24px; font-weight: bold; outline: none; }
.calc-btn { width: 100%; padding: 15px; background-color: #34495e; color: white; border: none; border-radius: 8px; font-size: 18px; font-weight: 600; cursor: pointer; transition: background 0.3s; margin-bottom: 25px; }
.calc-btn:hover { background-color: #2c3e50; }
#result-area { padding: 20px; background-color: #f9f9f9; border-radius: 8px; border-left: 5px solid #3498db; display: none; margin-bottom: 30px; }
.result-heading { font-size: 20px; font-weight: bold; margin-bottom: 10px; color: #2c3e50; }
.result-math { font-size: 22px; color: #e67e22; font-weight: bold; }
.info-section { margin-top: 40px; border-top: 1px solid #eee; padding-top: 20px; }
.info-section h2 { color: #2c3e50; font-size: 22px; margin-top: 25px; }
.info-section p { margin-bottom: 15px; color: #555; }
.example-box { background: #fdf6e3; padding: 15px; border-radius: 6px; margin: 10px 0; border: 1px solid #eee8d5; }
@media (max-width: 500px) {
.calc-row { flex-direction: column; }
.operator { transform: rotate(90deg); margin: 10px 0; }
}
function getGCD(a, b) {
a = Math.abs(a);
b = Math.abs(b);
while (b) {
var t = b;
b = a % b;
a = t;
}
return a;
}
function calculateFractionTimesWhole() {
var num = document.getElementById('numerator').value;
var den = document.getElementById('denominator').value;
var whole = document.getElementById('wholeNumber').value;
var resultArea = document.getElementById('result-area');
var mathDisp = document.getElementById('math-display');
var decDisp = document.getElementById('decimal-display');
var mixedDisp = document.getElementById('mixed-number-display');
if (num === "" || den === "" || whole === "") {
alert("Please fill in all fields.");
return;
}
var n = parseInt(num);
var d = parseInt(den);
var w = parseInt(whole);
if (d === 0) {
alert("Denominator cannot be zero.");
return;
}
// Calculation: (n/d) * w = (n*w)/d
var resultNumerator = n * w;
var resultDenominator = d;
// Simplify Fraction
var common = getGCD(resultNumerator, resultDenominator);
var simplifiedNum = resultNumerator / common;
var simplifiedDen = resultDenominator / common;
// Prepare Math Display
var mathText = n + "/" + d + " × " + w + " = " + resultNumerator + "/" + resultDenominator;
if (common > 1 || resultDenominator === 1) {
if (simplifiedDen === 1) {
mathText += " = " + simplifiedNum;
} else {
mathText += " = " + simplifiedNum + "/" + simplifiedDen;
}
}
mathDisp.innerHTML = mathText;
// Mixed Number Calculation
if (simplifiedNum > simplifiedDen && simplifiedDen !== 1) {
var wholePart = Math.floor(simplifiedNum / simplifiedDen);
var remainingNum = simplifiedNum % simplifiedDen;
mixedDisp.innerHTML = "Mixed Number: " + wholePart + " " + remainingNum + "/" + simplifiedDen;
mixedDisp.style.display = "block";
} else {
mixedDisp.style.display = "none";
}
// Decimal Display
var decimalValue = (n / d) * w;
decDisp.innerHTML = "Decimal Value: " + decimalValue.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 4});
resultArea.style.display = "block";
}
Fractions Times Whole Number Calculator
×
Result:
How to Multiply a Fraction by a Whole Number
Multiplying a fraction by a whole number is a fundamental arithmetic skill used in cooking, construction, and science. The process is straightforward because every whole number can be written as a fraction with a denominator of 1.
The Core Formula
To multiply a fraction by a whole number, you follow these steps:
- Multiply the numerator (top number) of the fraction by the whole number.
- Keep the denominator (bottom number) the same.
- Simplify the resulting fraction if possible.
Mathematically: (a/b) × c = (a × c) / b
Real-World Example:
If a recipe calls for 3/4 cup of sugar and you want to make 5 batches, you multiply:
3/4 × 5 = (3 × 5) / 4 = 15/4
As a mixed number, this is 3 and 3/4 cups.
If a recipe calls for 3/4 cup of sugar and you want to make 5 batches, you multiply:
3/4 × 5 = (3 × 5) / 4 = 15/4
As a mixed number, this is 3 and 3/4 cups.
Simplifying the Result
After multiplying, you often end up with an "improper fraction" (where the top is larger than the bottom). You can simplify this by finding the Greatest Common Divisor (GCD) or converting it to a mixed number by dividing the numerator by the denominator.
Common Conversion Table
| Fraction | Whole Number | Result |
|---|---|---|
| 1/2 | 4 | 2 |
| 2/3 | 6 | 4 |
| 3/5 | 10 | 6 |