програмування мовою паскаль функції

  • Published on
    12-Jul-2015

  • View
    252

  • Download
    4

Embed Size (px)

Transcript

1 (), . : , , ( ?) ?

2: , , : function Max (a, b: integer): integer;begin if a > b then Max := a else Max := b; end. 3: function , - Max (a, b: integer): integer;functionfunction Max (a, b: integer): ;integerfunction qq( a, b: integer; x: real ): real;a, b: integer; x: realfunction Max ( a, b: integer): integer;var4: , , , ; :function Max (a, b: integer): integer;begin ... end;Max := a;function qq (a, b: integer): float;

begin ...end;var x, y: float;5program qq;var a, b, max: integer;

begin writeln( '); read(a, b); max := Max ( a, b ); writeln( ', max );end.function Max (a, b: integer): integer;begin ... end;ccc , !! 6 : , , , .: (True False) (if, while): 2 N-1, . count := 0;for i := 2 to N-1 do if N mod i = 0 then count := count + 1;if count = 0 then { N }else { N } ??7 program qq;var N: integer;

begin writeln( '); read(N); if Prime(N) then writeln(N, ' ') else writeln(N, ' ');end.function Prime (N: integer): boolean;var count, i: integer;begin i := 2; count := 0; while i*i

Recommended

View more >