How to double a variable with bitwise shift left in Pascal

1 Answer

0 votes
program DoubleVariable;
var
  num: Integer;
begin
  num := 8;
  
  num := num shl 1;  // This will double the value of num
  
  WriteLn(num);
end.




(*
run:

16

*)

 



answered Mar 9, 2025 by avibootz

Related questions

1 answer 196 views
1 answer 186 views
1 answer 196 views
1 answer 180 views
1 answer 200 views
1 answer 193 views
1 answer 217 views
...