*/
If you have a PH account, you can customize your PH profile.
*/

View SAMPLES\GCD.PAS

Portable ISO Standard Pascal in C, version 3.8

Submitted By: WEBMASTER
Rating: starstarstarstar (Rate It)


(*$c+,d+*)
PROGRAM example(input,output);
VAR x, y : integer;
FUNCTION gcd(a, b: integer) : integer;
BEGIN
 {GREATEST COMMON DENOMINATOR PROGRAM:}
  CASE b = 0 OF
   true: gcd := a;
  false: gcd := gcd(b, a MOD b)
  END
END;
BEGIN
  write('type x = ');
  readln(x);
  writeln('x = ', x : 2);
  write('type y = ');
  readln(y);
  writeln('y = ', y : 2);
  writeln('gcd = ', gcd(x,y) : 2, '.')
END.

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.