Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Power-set/Ada/power-set.ada
Normal file
22
Task/Power-set/Ada/power-set.ada
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
with Ada.Text_IO, Ada.Command_Line;
|
||||
use Ada.Text_IO, Ada.Command_Line;
|
||||
|
||||
procedure powerset is
|
||||
begin
|
||||
for set in 0..2**Argument_Count-1 loop
|
||||
Put ("{");
|
||||
declare
|
||||
k : natural := set;
|
||||
first : boolean := true;
|
||||
begin
|
||||
for i in 1..Argument_Count loop
|
||||
if k mod 2 = 1 then
|
||||
Put ((if first then "" else ",") & Argument (i));
|
||||
first := false;
|
||||
end if;
|
||||
k := k / 2; -- we go to the next bit of "set"
|
||||
end loop;
|
||||
end;
|
||||
Put_Line("}");
|
||||
end loop;
|
||||
end powerset;
|
||||
Loading…
Add table
Add a link
Reference in a new issue