以下是我寫的程式:
var a,b,c,d,e:integer;
begin
read(a);
b:=a-15;
c:=24-15;
d:=(a-15-8)*(-1);
e:=a-15+24;
begin
if (a>15) and (a=15) then writeln (b);
if a=0 then writeln (c);
if (a>0) and (a<12) then writeln (d) else writeln (e);
end;
readln;
end.
我做了很多遍但都是NA,請問我寫的程式哪裡錯了???
var a,b,c,d,e,f:integer; //byte就夠了
begin
readln(a);
b:=a-15;
c:=24-15;
d:=(a-15-8)*(-1);
e:=a-15+24;
if (a>15) and (a=15) then f:=b; //不可能達成
if a=0 then f:=c;
if (a>0) and (a<12) then f:=d else f:=e;
if f >=60 then writeln(f-60) else writeln(f);
readln;
end.