Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODULE secenje;
- FROM InOut IMPORT WriteString, WriteLn;
- FROM RealInOut IMPORT WriteReal, ReadReal;
- PROCEDURE abs(n: REAL): REAL;
- BEGIN
- IF n < 0.0 THEN
- RETURN -n
- ELSIF n = 0.0 THEN
- RETURN 0.0
- ELSE
- RETURN n
- END;
- END abs;
- PROCEDURE dceobroj(n: REAL): BOOLEAN;
- CONST
- eps = 0.0001;
- VAR
- m : INTEGER;
- nabs, c : REAL;
- BEGIN
- nabs := abs(n);
- m := TRUNC(n);
- c := FLOAT(m);
- IF ((nabs - c) < eps) THEN
- RETURN TRUE
- ELSE
- RETURN FALSE
- END;
- END dceobroj;
- VAR
- n : REAL;
- ceo : BOOLEAN;
- BEGIN
- WriteString('Uneti n: ');
- ReadReal(n);
- ceo := dceobroj(n);
- IF ceo THEN
- WriteString('Broj je ceo')
- ELSE
- WriteString('Broj ima decimalni zarez')
- END;
- END secenje.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement