1

Is It There or Not?

 2 years ago
source link: http://programmingbydoing.com/a/is-it-there-or-not.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Is It There or Not?
  • Author: Graham Mitchell
  • Filename: IsItThereOrNot.java

Is It There or Not?

Create an array that can hold ten integers, and fill each slot with a different random value from 1-50. Display those values on the screen, and then prompt the user for an integer. Search through the array, and if the item is present, say so. If the value is not in the array, display a single message saying so. Just like the previous assignment, if the value is present more than once, you may display the message as many times as necessary.

Array: 45 39 32 12 44 50 26 42 16 20
Value to find: 42

42 is in the array.
Array: 45 39 32 12 44 50 26 42 16 20
Value to find: 43

43 is not in the array.

©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK