Skip to content

Instantly share code, notes, and snippets.

@TPAKC
Created May 24, 2017 04:36
Show Gist options
  • Save TPAKC/2f232d81d47ba14f6473a5542891f3fc to your computer and use it in GitHub Desktop.
Save TPAKC/2f232d81d47ba14f6473a5542891f3fc to your computer and use it in GitHub Desktop.
program Project2;
var
c: char;
f: text;
a,rem1,rem2: integer;
begin
assign(f, 'nine.in');
reset(f);
rem1 := 0;
while not eoln(f) do
begin
read(f, c);
rem1 := (rem1 + ord(c) - ord('0')) mod 9;
end;
readln(f);
rem2 := 0;
while not eoln(f) do
begin
read(f, c);
rem2 := (rem2 + ord(c) - ord('0')) mod 9;
end;
readln(f);
a := rem1 * rem2;
close(f);
assign(f, 'nine.out');
rewrite(f);
if a mod 9 = 0 then
write(f, 'YES')
else
write(f, 'NO');
close(f);
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment