1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Debora [2.8K]
2 years ago
9

should variables that contain numbers always be declared as integer or floating-point data types? why or why not? name potential

examples.
Computers and Technology
1 answer:
Stells [14]2 years ago
6 0

No, it is not necessary that variables that contain numbers should always be declared as integer or floating-point data types.

It is not necessary that variables that contain numbers should be declared as integer and floating point data types. Because number can be declared with different data types.  As we know that data type is a vital aspect in programming. It describes the type of a value that is contained in a variable. It is the data type based on which memory is allocated to a number or any type of variables.

Numbers can be whole decimal/fractional, signed, unsigned, small, and long. Simply, they exist in a variety of values. According to their values range, the amount of memory is reserved.

Different programming languages offer different data types to store numbers, depending on their types and size. Let’s consider some examples of data types used in programming languages in order to declare variables holding numbers.

  • In Python int, float, and complex are the data types used to declare number type variables.
  • SQL uses INTEGER, SMALLINT , BIGINT , NUMERIC() , and DECIMAL() data types for numbers.
  • To deal with number type variables, Java has six predefined data types, such as int, long, short, byte, float, and double.
  • JavaScript uses a single data type called 'number' to declare numbers.
  • In C++, two fundamental data types, int and float, are used to represent numeric variables. But C++ is not only limited to these two data types. The data type char can also store numbers. Other data types for declaring numbers as variables are derived from int, float and char, such as short int, long int, signed int, unsigned int, double, long double, signed char, unsigned char etc. etc.

So in concluding remarks, declaring a number type variable is not only limited to using integers and floating-points data types. Rather it entirely depends on the respective programming language, and size and type of the number to be stored in the variable.

You can learn more about data types at

brainly.com/question/13438922

#SPJ4

You might be interested in
Draw a full binary tree of height 2. How many nodes does it have?
Paraphin [41]

Answer:

The number of nodes in a full binary tree of height 2 = 7

Explanation:

At each level k, of the full binary tree there are usually 2^{k} \\ nodes.

So the full binary tree of height 2 has nodes= 2^{0} \\ + 2^{1} \\ + 2^{2} \\.

which is 7.

6 0
4 years ago
What does digital mean, in the term of computer science.
mote1985 [20]

Answer:

Digital describes electronic technology that generates, stores, and processes data in terms of two states: positive and non-positive.

Explanation:

5 0
3 years ago
Computer virus is a<br> a. software<br> b. hardware<br> c. bacteria<br> d. none of these
Nimfa-mama [501]
The answer is software
8 0
4 years ago
Validation ensures that a website looks good.<br> True or False
Nezavi [6.7K]
The answer would be false. Validation doesn't have to do with a website looking good, validation is just checking the quality of the logic and backing up a statement with information that proves a statement to be true
8 0
4 years ago
Which network device is capable of blocking network connections that identify as potentially malicious
Katarina [22]
Gateway is the correct answer
6 0
3 years ago
Other questions:
  • True or false. Embedding only part of a font is called presetting.
    14·1 answer
  • Does anyone know the code for codeHS 5.4.7 teenagers?
    8·1 answer
  • Explain what a honeypot is. In your explanation, give at least one advantage and one disadvantage of deploying a honeypot on a c
    12·1 answer
  • What does prioritization help you to do?
    12·2 answers
  • What do character formats do for your document's message? A. Set how text aligns within a document B. Provide organization C. Pr
    6·2 answers
  • When a person devises the idea for the venture, develops a business plan, uses savings or loans to acquire other resources and a
    9·1 answer
  • In many programming environments today, one language translates the programmers' code into a different language before the compu
    6·1 answer
  • Describe the three essential characteristics of an object fromthe perspective of object oriented paradigm.
    7·1 answer
  • Who you think is better? Ninja or TFue ,btw do you know who icebear is?
    9·1 answer
  • What two functions does tcp/ip perform?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!