Computer Science, asked by srishtirani20, 7 months ago

write a program to display that concept that we can assign new values to a variable as many times as required during the execution of the program​

Answers

Answered by deepakPGDV
1

Variables - Symbolic Nature

Variables in a computer program are analogous to "Buckets" or "Envelopes" where information can be maintained and referenced. On the outside of the bucket is a name. When referring to the bucket, we use the name of the bucket, not the data stored in the bucket.

Variables are "Symbolic Names". This means the variable "stands in" for any possible values. This is similar to mathematics, where it is always true that if given two positive numbers (let's use the symbols 'a' and 'b' to represent them):

a + b > a

(i.e., if you add any two numbers, the sum is greater than one of the numbers by itself).

This is called Symbolic Expression, again meaning, when any possible (valid) values are used in place of the variables, the expression is still true.

Another example, if we want to find the sum of ANY TWO NUMBERS we can write:

result = a + b;

Both 'a' and 'b' are variables. They are symbolic representations of any numbers. For example, the variable 'a' could contain the number 5 and the variable 'b' could contain the number 10. During the execution of the program, the statement "a + b" is replaced by the Actual Values "5 + 10" and the result becomes 15. The beauty (and responsibility) of variables is that the symbolic operation should be true for any values.

Another example, if we want to find out how many centimetres tall a person is, we could use the following formula: height in centimetres = height in inches *

Similar questions
Math, 3 months ago