Program determine maximal divisor. Use Euklide algorithm.
Delphi & Pascal (česká wiki)
Category: Homework in Pascal
Author: Juraj Pupák
Program: Algoritm.pas
File exe: Algoritm.exe
File ubuntu: Algoritm
Author: Juraj Pupák
Program: Algoritm.pas
File exe: Algoritm.exe
File ubuntu: Algoritm
Program determine maximal divisor. Use Euklide algorithm.
{ ALGORITM.PAS } { Program na vypocet najvacsieho spolocneho delitela. } { Pre vypocet je pouzity Euklidov algoritmus. } { } { Author: Juraj Pupak } { Date : 27.10.2006 http://www.trsek.com } program EuklidovAlgoritmus; uses crt; var number_1,number_2,temp : integer; begin clrscr; writeln('Program na vypocet najvacsieho spolocneho delitela'); writeln('Pre vypocet je pouzity Euklidov algoritmus'); writeln('--------------------------------------------------'); writeln('Zadaj prve cislo'); readln(number_1); writeln('Zadaj druhe cislo'); readln(number_2); clrscr; Repeat IF number_1 < number_2 THEN begin temp := number_1; number_1 := number_2; number_2 := temp; end; number_1 := number_1 mod number_2; Until number_1 = 0; writeln(number_2); readln; end.