Write an algorithm (in pseudocode, with proper indentation for blocks of code in loops or conditional statements) that finds and returns the location of the first negative integer in a sequence of integers.
Algorithm:
An algorithm is a step-by-step procedure that gives a solution to the problem.
The algorithm finds and returns the location of the first negative integer in a sequence of integers is given below:
Step 1: Start
Step 2: Declare arr[], sizeArr, loc
Step 3: Input the array and size of the array
Step 4: For i = 0 to sizeArr-1
Step 4.1: If arr[i] < 0
Step 4.1.1: loc = i and return
Step 4.1.2: End If
Step 4.3: End For
Step 5: Display the 'loc'
Step 6: Stop
Get Answers For Free
Most questions answered within 1 hours.