Pascal Program to Read in Even Numbers Into An Array


This program takes in only even numbers into an array of two rows and two columns. Here, a loop and conditional statement is used.

Program Eve;
Label 10;
Var
A : array[1..2,1..2] of integer;
I, j: integer;
Begin
For I:= 1 to 2 do
   For j:=  1 to 2 do
    Begin
10: readln (A[I , j]);
   If A[I , j] mod 2  < > 0 then goto 10
   Else
   End;
Begin
For I:= 1 to 2 do
For j:= 1 to 2 do
Writeln (A[I , j] );
Readln;
End.



Share on Google Plus

About Grace Joseph

Grace Joseph is a tech blogger from Cross River State, Nigeria. She studied Computer Science in University of Calabar and is a lover of tech, music and the Internet. You can follow her on Facebook and Google+

0 comments:

Post a Comment