Q18
NATMarks unknownThe following is an incomplete Pascal function to convert a given decimal integer (in the range to ) into a binary integer in ’s complement representation. Determine the expressions that complete program. function TWOSCOMP (N:integer):integer; var REM, EXPONENT:integer; BINARY :integer; begin if(N>=-8) and (N<=+7) then begin if N<0 then N:=A; BINARY:=0; EXPONENT:=1; while N<>0 do begin REM:=N mod 2; BINARY:=BINARY + B*EXPONENT; EXPONENT:=EXPONENT*10; N:=C end TWOSCOMP:=BINARY end end;
Sign in to save attempts.
Loading…