Final answer:
A constant in a computer program is a value that never changes during the execution of the program, while a variable can change. Constants help maintain essential values that should remain fixed. For instance, a constant might represent a mathematical constant like PI, which is approximately 3.14.
Explanation:
What is a Constant in a Computer Program?
A constant in a computer program is a value that is set once and cannot change during the program's execution. For example, if you create a constant to represent the number of days in a week, you can assign it a value of 7. This value will remain 7 throughout the program and cannot be altered.
In contrast, a variable is a value that can change; for instance, if you had a variable representing the number of students in a class, you might start with a value of 30, but this number could change as new students enroll or others leave.
Constants are often used for fixed values that are important to the operation of the program and help ensure that certain essential values remain unchanged. In most programming languages, they are defined using specific keywords such as const in JavaScript or final in Java.
Learn more about constant here:
https://brainly.com/question/44174330