Calculate the average of numbers entered by user. If user enters negative number, it ignores that number and calculates the average of number entered before it

Calculate the average of numbers entered by user. If user enters negative number, it ignores that number and calculates the average of number entered before it

Input:

3 4 5 -1

Output:

The average of numbers is 4

Implementation: