/* Rexx Workshop - Compute average of input numbers */
/*                                                  */
 
 
/* Prompt the user for how many items to compute    */
/* the average of, and accept the input value.      */
say "How many items do you want to compute the average of?"
pull number_of_items
 
 
/* Initialize the sum of the items                  */
say " "
item_sum = 0
 
/* Loop to prompt for each item, accept input, and  */
/* update the sum of items.                         */
 
Do item_number = 1 to number_of_items
   say "Enter item " item_number
   pull item
   item_sum = item_sum + item
End
 
/* Compute the average of the input items and       */
/* display it.                                      */
average = item_sum / number_of_items
 
say " "
say "The average of your items is" average
 
exit