with ada.text_io; use ada.text_io;
with ada.integer_text_io; use ada.integer_text_io;
procedure array1 is
subtype animal_range is Integer range -3 .. 3;
cat_count: array(animal_range) of Natural := (-3 | -1 | 1 | 3 => 1, others => 0);
dog_count: array(animal_range) of Natural := (-2 | 0 | 2 => 1, others => 0);
animal_count: array(animal_range) of Natural;
total_dogs, total_cats, total_animals: Natural := 0;
begin
for i in cat_count'first .. cat_count'last loop
total_cats := total_cats + cat_count(i);
end loop;
for i in dog_count'range loop
total_dogs := total_dogs + dog_count(i);
end loop;
for i in animal_range loop
animal_count(i) := cat_count(i) + dog_count(i);
end loop;
for a of animal_count loop
total_animals := total_animals + a;
end loop;
put_line(total_animals'img);
end array1;