|
|
вернуться в форумPASCAL WHY WA1?? Послано phloyd 5 ноя 2018 20:59 Am I stupid or what? code seems to be working var x,a,b:integer; function sum(x:integer): INTEGER; var s:integer; begin while x>0 do begin s:=s+x mod 10; x:=x div 10; end; sum:=s; end; begin read (x); a:=x div 1000; b:=x mod 1000; if (sum(a)=sum(b+1)) or (sum(a)=sum(b-1)) then writeln ('Yes') else writeln ('No'); end. Re: PASCAL WHY WA1?? Pay attention to inc and dec in your code. You should do first x+1 and x-1. I hope you understand me |
|
|