Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  H
Language: PASCAL
Code:

uses crt;
var N,i,dem:longint;
a:array[1..100] of longint;
f1,f2:text;
function sohoanhao(n:longint):boolean;
var S,i:longint;
shh:boolean;
Begin
S:=0;shh:=true;
for i:=1 to n-1 do if n mod i = 0 then S:=S+i;
if n<>S then shh:=false;
sohoanhao:=shh;
End;
{----------------------------------------------------}
BEGIN
assign(f1,'sohoanhao.inp');reset(f1);
assign(f2,'sohoanhao.out');rewrite(f2);
readln(f1,N); dem:=0;
for i:=1 to N do
Begin
readln(f1,a[i]);
if sohoanhao(a[i]) then inc(dem);
End;
write(f2,dem);
close(f1);close(f2);

END.
Comments: