Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with entrees_sorties; use entrees_sorties;
- procedure un is
- n, c, i, nb, pi : Integer;
- procedure trace(num : in Integer) is
- begin
- new_line;
- put("[trace "&Integer'Image(num)&"]/[n="&Integer'Image(n)&"][c="&Integer'Image(c)&"][i="&Integer'Image(i)&"][nb="&Integer'Image(nb)&"][pi="&Integer'Image(pi)&"]");
- new_line;
- end trace;
- begin -- Algorithme5
- get(n);
- c := 0;
- i := 1; trace(1);--1
- while i <= n loop
- get(nb); trace(2);--2
- if nb mod 2 = 1 then
- if c = 0 then
- pi := nb;
- c := 1; trace(3);--3
- else
- c := c + 1; trace(4);--4
- end if;
- end if;
- i := i + 1; trace(5);--5
- end loop;
- put("PI = ");put(pi); new_line;
- put("C = ");put(c);
- end un; -- Algorithme5
Advertisement
Add Comment
Please, Sign In to add comment