start get firstInput if firstInput >= 0 then while secInput > -1 get secInput add 1 to counter add sum to sec end while print avg