Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

LAB 11

I.

A.

The float function returns the floating-point value equivalent to the number passed as is or in the form
of a string. Then, a for loop was used so data can be executed repeatedly.

B. The same codes were used here and in letter A of part 1 of the activity. It uses the float function and
the for loop to execute it repeatedly. The only difference is that here, kilometer or distance is the focus
and not the temperature anymore. It has also different values.

III.

OPERATORS DESCRIPTION
%10.2f FORMAT 2 DECIMAL PLACES. THE WHOLE STRING OCCUPIES 10
CHARACTERS.
%15.2f FORMAT 2 DECIMAL PLACES. THE WHOLE STRING OCCUPIES 15
CHARACTERS
C+=10 COMPOUND ASSIGNMENT OPERATOR FOR CELCIUS. ADDS RIGHT
OPERAND TO THE LEFT OPERAND AND ASSIGN THE RESULT TO THE LEFT.
Km+=10 COMPOUND ASSIGNMENT OPERATOR FOR KILOMETERS. ADDS RIGHT
OPERAND TO THE LEFT OPERAND AND ASSIGN THE RESULT TO THE LEFT.
Km<=40 COMPOUND ASSIGNMENT OPERATOR FOR KILOMETERS. CHECK IF
OPERAND ON LEFT IS SMALLER THAN OR EQUAL TO RIGHT OPERAND.

IV.

QUESTIONS:

4. WHAT ARE THE FUNCTION OF THESE CODES:

WHILE (gallon != -1)

Used for infinite loop. The condition will be always true and so what are present inside the loop
will be executed.

If (total_gallons !=0)

It allows the program to select an action based upon the user’s input.

5. EXPLAIN THE PRINCIPLE/CONCEPT OF COURSE III-A.?

Source code is the fundamental component of a computer program that is created by a


programmer. It should be easy to read and understood by a human being. Source code is also used so
that skilled users can more easily customize software installations. It can be use to create similar
programs for other operating platforms.
6.

You might also like