I dont really understant what is the difference between real and integer in this program
"This" program does not use any real AFAICS.
An integer is a number that has no fractionional part. E.g -10, 2, 1024
A real number is a value of a continuous quantity that can represent a distance along a line. (In mathematics this also includes all integer numbers, but in computers we mean floating point numbers like 3.14, 99.99 etc.)
The type "real" is rather ancient.
Nowadays we use single, double or extended (the latter is not supported on all platforms though)
and while doing this program i have been really struggling with this line: for y:=1 to N do begin ( I dont understant what role is the begin doing here)
The for syntax is like:
for loopcounter := startvalue to endvalue do statement;
"statement" can be a single statement like writeln(loopcounter), or a compund statement, a group of statements separated by semicolons (;) and surrounded by the keywords
begin and
end.
It is also perfectly OK to have a single statement enclosed in begin..end, like in your example.
As my explanation of the syntax shows, in your example the begin..end in the for loop can be omitted.
Bart