You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
409 B
Plaintext
21 lines
409 B
Plaintext
{ Example IP exam assignment with a basic while loop }
|
|
program missing;
|
|
{ Takes a number N, then N unique numbers <= N of which one is 0. Prints the missing number <= N }
|
|
|
|
var n, total, a, i : integer;
|
|
|
|
begin
|
|
readln(n);
|
|
total := n;
|
|
i := 0;
|
|
|
|
while i < n do
|
|
begin
|
|
readln(a);
|
|
total := total + i;
|
|
total := total - a;
|
|
i := i + 1
|
|
end;
|
|
|
|
writeln(total)
|
|
end. |