TypeScript bootcamp · Lab 37

Celsius to Fahrenheit

easyNumbers8 minLesson: Math

Read the question, write TypeScript on the right, then Run or Check.

QuestionHint and solution stay closed until you open them

Read Celsius; log Fahrenheit F = C * 9 / 5 + 32 (integer math).

Examples

Example 1
Input
0
Output
32
Example 2
Input
100
Output
212
Hint
  1. Math.trunc or |0 for int division if needed — here * / + is fine with Number.
Show correct code

Peek only after you have tried. You can still Check your own version.

const c: number = Number(readLine());
console.log(((c * 9) / 5) + 32);
main.tstsc · readLine() · Ctrl + Enter
ResultIdle
Run to see output. Check grades the tests.