Fix wrong calculation for converting celsius to fahrenheit
This commit is contained in:
parent
6ee51970fc
commit
eee9539ac2
1 changed files with 1 additions and 1 deletions
|
@ -14,7 +14,7 @@ module.exports = {
|
||||||
switch (args[1].toUpperCase()) {
|
switch (args[1].toUpperCase()) {
|
||||||
case "C":
|
case "C":
|
||||||
if (args[2].toUpperCase() === "F") {
|
if (args[2].toUpperCase() === "F") {
|
||||||
const fahrenheit = ((parseFloat(args[0]) * 5 / 9) + 32).toFixed(2);
|
const fahrenheit = ((parseFloat(args[0]) * 9 / 5) + 32).toFixed(2);
|
||||||
sendText = `${args[0]}°C is ${fahrenheit}°F`;
|
sendText = `${args[0]}°C is ${fahrenheit}°F`;
|
||||||
} else {
|
} else {
|
||||||
sendText = "Can only convert to celsius from fahrenheit";
|
sendText = "Can only convert to celsius from fahrenheit";
|
||||||
|
|
Loading…
Add table
Reference in a new issue