Computer Science – Programming | e-Consult
Programming (1 questions)
Login to see all questions.
Click on a question to view the answer
Answer:
A float (floating-point number) is a type of real number that can represent numbers with a decimal point. An integer is a whole number without a decimal point. The key difference is the ability to store fractional values.
You would choose to use a float data type when you need to represent numbers that are not whole numbers, such as prices, temperatures, or measurements. For example, if you are calculating the area of a circle, the result will often be a decimal number, so a float is necessary.