1. with Ada.Text_IO; use Ada.Text_IO; 
  2.  
  3. procedure Counter_Test is 
  4.  
  5.    Sum : Natural := 50; 
  6.  
  7.    task type Counter (Id : Positive; Goal : Natural); 
  8.  
  9.    task body Counter is 
  10.  
  11.    begin 
  12.       while Sum /= Goal loop 
  13.          Sum := (if Sum > Goal then Sum - 1 else Sum + 1); 
  14.          Put (Natural'Image (Sum)); 
  15.          delay 0.0; -- try leaving out this delay statement! 
  16.       end loop; 
  17.  
  18.       New_Line; 
  19.       Put_Line ("Counter task" & Positive'Image (Id) & " terminates with sum being:" & Natural'Image (Sum)); 
  20.    end Counter; 
  21.  
  22.    Counter_1 : Counter (1, 30); 
  23.    Counter_2 : Counter (2, 40); 
  24.    Counter_3 : Counter (3, 60); 
  25.    Counter_4 : Counter (4, 70); 
  26.  
  27. begin 
  28.    New_Line; 
  29.    Put_Line ("Counter_Test terminates with sum being:" & Natural'Image (Sum)); 
  30. end Counter_Test;