By pragyansharma polavarapu
As in algebra the most important things in computer
programming are“CONSTANTS” and “VARIABLES”. They are the foundation
bricks in computer programming. All computer programming is based on selecting
names for CONSTANTS and VARIABLES and declaring the information at start of
every software program .
Let us take example of a
big busy hotel of 100 rooms. The ten floors have ten
rooms each .the rooms are neatly numbered AI to A10, B1 TO B10,C1 TO C10 and so
on for all ten floors. Daily guests come and rent rooms for a day or two . Some
new persons come and some of the earlier occupants leave every day.
For the hotel workers the names of the persons occupying the rooms or
even their faces are not important. They are guided only by the room number .
The manager simply tells a worker to take coffee to
room A -9, attend a call from room F-4 etc. In language of
mathematics the room numbers are called “CONSTANTS” as they remain constant
and unchanged. Only the persons inside change.The persons inside are the
“VARIABLES”(though they may be having tough strong invariable unchanging
mindsets!)
The great importance of CONSTANTS and VARIABLES in every
mathematical program can be seen from following simple example.in computer the
“software programs” are just like algebra equations .
(At the very start of program we should declare names/symbols
indicating CONSTANTS and VARIABLES. In example
below ordinary numbers 1234… are CONSTANTS and a,b,c,k are VARIABLES)
Ex: 2a+3b+5c=k .
First we give a=2,b=3 and c=4 and get an answer k 1
In a second problem we give a=20, b=30 and c=30. The answer is k 2
We get a different value of k in each case . The computer’s
power is colossal. Even if we give 2000
or 20,000 sets of values to a,b and c we
get the 2000/20,000 values for k in a
split second. This concept of constants and variables is basic to computer
logic and is most necessary to understand how the computer’s digital brain
works.
Comments
Post a Comment