Working with numbers#

Numbers can be stored in variables#

PI <- 3.14159
OUTPUT PI

You can do math with numbers#

Operator

Description

+

addition

-

subtraction

*

multiplication

/

division

^

raised to the power of

FirstNum <- 6
SecondNum <- 2
OUTPUT FirstNum + SecondNum
OUTPUT FirstNum ^ SecondNum

Numeric values are used for math operations#

Price <- 1
FederalTax <- 0.07
PriceWithTax <- Price + Price * FederalTax
OUTPUT PriceWithTax

Exercises#

Exercise

Write a statement to calulate and display the answer to the calulation:

(7 * 3) + (16 / 5)

// Click 'edit' button to input your code.

Exercise

Predict what is printed when runs these statements.

Num <- 16
Num <- Num + 1
Num <- Num + 3

OUTPUT "Num is ", Num

Exercise

The formula for converting a Fahrenheit temperature (F) to Celsius (C) is

C = (F 32) * 5 / 9

Write a program to allow a user to enter a Fahrenheit temperature, convert the temperature to Celsius and print out the result of the conversion.

Test your program four times, ehtering temperatures of 212, 89.5, 32, -40

At what temperature are the Fahrenheit and Celsius temperatures the same value?

// Click 'edit' button to input your code.