Loops/While: Difference between revisions

Content added Content deleted
(Added Haskell example)
(Added Ada)
Line 1: Line 1:
{{task}}Start a value at 1024. Loop while it is greater than 0. Print the value (with a newline) and divide it by two each time through the loop.
{{task}}Start a value at 1024. Loop while it is greater than 0. Print the value (with a newline) and divide it by two each time through the loop.

=={{header|Ada}}==
<ada>
declare
I : Integer := 1024;
begin
while I > 0 loop
Put_Line(Integer'Image(I));
I := I / 2;
end loop;
end;
</ada>


=={{header|BASIC}}==
=={{header|BASIC}}==