4.4 Exercises
4.4.1 Variable declaration
See Section 12.0.4 for solutions.
Declare two variables
a
andb
and set them to 5 and 18, respectively. Then usebc
to calculate their product.Declare a variable
course
that contains “Introduction to UNIX” and another variablechapter
that contains “Chapter 4”. Using the defined variables, print to the screen the following message: “Introduction to UNIX: Chapter 4!”Declare a variable
message
and set it to 42. Then declare a variablefile
and set it toanswer.txt
. Printmessage
tofile
.Declare an additional variable
truth
that should contain the content ofmessage
. Then changemessage
to hold 43 and use these variables to print “The truth istruth
notmessage
”