Skip to content

Instantly share code, notes, and snippets.

@tuankiet65
Last active December 15, 2015 21:29
Show Gist options
  • Save tuankiet65/5325767 to your computer and use it in GitHub Desktop.
Save tuankiet65/5325767 to your computer and use it in GitHub Desktop.
program bt;
uses crt;
var inp: anstring;
i: longint;
tmp, chk: byte;
tong: int64;
begin
clrscr;
write('Nhap n: ');
readln(inp);
for i:=1 to length(inp) do begin
val(inp[i], tmp, chk);
if i mod 2=0 then tong:=tong-tmp else tong:=tong+tmp;
end;
write(tong);
readkey;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment