PROGRAMMING PASCAL
LESSON 2
In this lesson we will learn variables integer; real; char; string...
Example:
Integer: 25 4 -2 3 85
Real: 120.36 -9.66 45.12
Char: A B C D E f g h i j k l
String: PASCAL programming Hello
we put variables after uses wincrt line.
Example var Num1,Num2:Integer;
Integers have ranges limits and types
Reals also have types:
You can use Real or Double.
Operators in Pascal
+ Addition
- Substraction
* Multiplication
/ Division (Integer/real result)
DIV Division (Integer result)
MOD Division (Integer result the rest of division)
> Superiour
< Inferiour
<> Differnce
= Equality
When we use variables we use in the main program readln to read the varible
Example
program test;
uses wincrt;
var Num1:Integer;
begin
write('Enter an integer');
readln(Num1);
write(Num1);
end. Pascal
Aucun commentaire:
Enregistrer un commentaire