(10) What is Variable?
Variable is a character or group of character assigned by the programmer to a single memory location and used a in the program as the name of that memory location in order to access the value stored in it.
Example:-
x=7
X is a variable
Y = x+5 = 7+5=12
Z = y+5 = 12+5=17
Naming rules to defined a variable:-
~first letter must be an alphabet or under s (-)l
~no space or special character except under score allowed in
a variable.
~ A variable name in case sensitive a=5, y= a+5 here, a has
other value& a has another value.
~A variable name is collection of alphabet, digit or
underscore. Ex :- A2=5 A2 - = A2
( the first letter must be alphabet or underscore)
~ Maximum number of character is a variable may be 8or32 depends on system configuration ( processor).
~1. abc 2. abc 3. ab$c 4. $abc 5. ab-c 6. 2 ab. 7. mohit
kumar. 8. abcd-
1. true.
2. false.
3.False.
4. false.
5. false.
6. false.
7.false.
8. true.
Constant :-
It is a fixed value which is used in a programme
to perform a task. It may be used to assign a value to variable
A constant may be of following types:-
1. numbers
A. integer ( without decimal).
B. float (real , with decimal).
2. character (single alphabet).
3. string ( group of character).
4. Boolean ( true or false)
Nice sir
ReplyDelete