131k views
1 vote
Which data type declares a variable that stores a positive or negative whole number?

1) boolean
2) integer
3) float
4) string

User Dleep
by
8.0k points

1 Answer

2 votes

Final answer:

An integer is the data type that declares a variable for storing whole numbers, both positive and negative.

Step-by-step explanation:

The data type that declares a variable that stores a positive or negative whole number is an integer.

An integer is a data type in programming languages that represents whole numbers without any fractional or decimal components. It can store both positive and negative values. For example, the variable 'x' declared as an integer can hold values like -5, 0, or 10.

User Sandor Davidhazi
by
7.7k points