Skip to content

Commit

Permalink
Dodanie euclid1.f euclid1.pas
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrochowski committed Oct 1, 2024
1 parent 0552f87 commit 01cc8a5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
15 changes: 15 additions & 0 deletions euclid1.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PROGRAM EUCLID1
c Algorytm Euklidesa w jezyku Fortran 77

WRITE (*,*) 'Podaj dwie liczby calkowite: '
READ (*,*) N, M

DO WHILE ( N .NE. M )
IF ( N .GT. M ) THEN
N = N - M
ELSE
M = M - N
ENDIF
ENDDO
WRITE (*,*) 'NWD=', N
END
16 changes: 16 additions & 0 deletions euclid1.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
program NWD(input,output);
{ Algorytm Euklidesa. }
var
A, B : Integer;
begin
Writeln('Podaj dwie liczby calkowite: ');
Readln(a,b);

while a <> b do
begin
if a > b then a := a - b
else b := b - a;
end;
Writeln('NWD = ', a);
end.

0 comments on commit 01cc8a5

Please sign in to comment.