Saturday, November 10, 2018

Variables and Data Types

Variable
Some memory is allocated to store a particular type of data and that portion of memory will be referred to by the variable name.
Data type may be numeric, alphanumeric.
Numeric:that stores numbers.
Alphanumeric:that stores alphabets and numbers.
The general form of declaring variables is :
data type (variable name )

Eg.
Step1.  Start
Step2.  X=10
Step3. Y=5
Step4. M=0
Step5. M=X+Y+(X*Y)
Step6. Y=Y+4
Step7. M=M+Y
Step8. Display X,Y,M
Step9. End

Dry Run
                             X.         Y.           M
Initial values.     10.      5.             0
After step5.          10.      5.             65
After step6.          10.       9.             65
After step7.          10.       9.              74

No comments:

Post a Comment