---
title: CSCI 1301 -- Lab 26
author: Clément Aubert
lang: en
fontsize: 10pt
documentclass: scrartcl
numbersections: true
links-as-notes: true
papersize: letter
geometry: margin=1in
keywords:
- Computer Science
- Problem solving methods
- Syllabus
- Augusta University
- Bachelor of Science
---


# Array Algorithms

Write a program that

#. declares an array `myArray` of `int` of size $10$,
#. intitializes `myArray` with ten values of your choice (one of them should be $5$),
#. displays the content of `myArray`,
#. displays the greatest value in `myArray`,
#. displays the lowest value in `myArray`,
#. displays the average of the values in `myArray`,
#. display `true` if the number $5$ occurs in `myArray`, false otherwise,
#. display the smallest index where the number $5$ occurs in `myArray`, $-1$ otherwise,
#. display `true` if every number in `myArray` occurs exactly once.

An example of execution could be:

```
The content of the array is: 0 3 5 -3 10 5 7 8 9 123
The greatest value in the array is: 123
The lowest value in the array is: -3
The average of the values in the array is: 16.7
The number 5 occurs in the array: true
The smallest index where the number 5 occurs is: 2
Every number occurs exactly once in the array: false
```

Once this works, change the values in the array and make sure your program has the right output.

# Array Algorithms: Pushing Further (Optional)

Continue working on your program, and add portion of code that

#. display the first index where the lowest value of `myArray` occurs,
#. display the last index where the greatest value of `myArray` occurs,
#. declare a second array of `int`, and fills it with values,
#. display `true` if the second array is of the same size as `myArray`,
#. display `true` if the second array has at least one value in common with `myArray`.
