171k views
2 votes
Write a pseudocode statement that declares the variable cost so it can hold real numbers.

A) DECLARE cost AS REAL
B) SET cost TO REAL
C) REAL cost
D) DEFINE cost AS REAL

1 Answer

3 votes

Final answer:

The correct pseudocode statement to declare a variable named 'cost' for real numbers is 'DECLARE cost AS REAL'. This is a common way to specify variable types in pseudocode, which helps in planning the logic of a program.

Step-by-step explanation:

The correct option for writing a pseudocode statement that declares the variable cost so it can hold real numbers is:

A) DECLARE cost AS REAL

Pseudocode is a way to describe the logic of a program in an informal and readable manner, without getting into the specific syntax of a programming language. When declaring a variable in pseudocode, we use general terms to specify what a variable should be able to store or represent. In this case, 'DECLARE cost AS REAL' perfectly fits the requirement as it clearly states that the variable named cost is to be used for real numbers, which are numbers that can have a fractional part.

User Kevin Ternet
by
8.3k points