Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with Arrays
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ChuChun




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu Mar 09, 2017 12:15 pm   Post subject: RE:Help with Arrays

What have you tried?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: