Which of the Following Can Store a Number Containing a Decimal Place?
Implementation: Data types and structures
Data is stored differently depending on its type. Numbers are stored equally integers or existent numbers, text as string or characters. Lists of the aforementioned type of data can be stored in an array.
Storing numbers
Integers
The post-obit code is used to create an INTEGER variable that will be used to store an age.
DECLARE age Equally INTEGER INITIALLY 0 SEND "Enter your age" TO Display RECEIVE age FROM KEYBOARD The user is asked to enter their age and when they type in a number, the value is stored in the 'historic period' variable.
An integer is a whole number - a number without decimal places.
Integers can be positive or negative.
Examples of integers:
- 24
- -36
- 4303
- -89730
- 7903493
- 0
This program volition only accept a whole number. Anything else will cause an error. Here's that line of code running:
When the number 45 is entered the program works fine. However, here's the same line of code running with something unlike entered:
Hither the user entered the give-and-take 'former' when they were asked for their historic period. The programme was expecting an integer (a whole number) and therefore shows an fault.
To store a whole number, use the information type known every bit an 'integer'.
Real numbers
Numbers that incorporate a decimal betoken are stored in a data type called REAL.
Variables that utilise the real information blazon tin have both positive and negative numbers with a decimal place.
Source: https://www.bbc.co.uk/bitesize/guides/zghbgk7/revision/3
0 Response to "Which of the Following Can Store a Number Containing a Decimal Place?"
Enviar um comentário