Computer Science Canada

Help with Arrays

Author:  ChuChun [ Thu Mar 09, 2017 5:37 am ]
Post subject:  Help with Arrays

How would one do this:
Write a program that asks the user for the number of values they would like to use. Force the user to give a number between 5 and 20 (inclusive). Read that many numbers into an array declared as:

var nums : array 1 .. 20 of int.

It doesn't matter that some of the elements in the array may not be used. After reading all the values, find and print the mean (average) of all the numbers in the array.

Print all the elements in the array on 1 line with a space between each number. Any numbers less than the mean should be printed in red and any greater than the mean should be in green. If any happen to be equal to the mean print the number in black.

Print the largest and smallest values in the array in blue. Here is a sample run of the program:

using arrays?

Author:  Insectoid [ Thu Mar 09, 2017 12:15 pm ]
Post subject:  RE:Help with Arrays

What have you tried?


: