Which of the Following Can Store a Number Containing a Decimal Place?

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:

Displaying a user's age on a laptop screen.

When the number 45 is entered the program works fine. However, here's the same line of code running with something unlike entered:

Coding behind the user's age.

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'.

Integers tin store only positive or negative whole numbers

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.

Existent numbers store positive or negative values that include a decimal point e.grand. eighteen.88

loftonmationdeed.blogspot.com

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

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel