How Many Times?
source link: http://programmingbydoing.com/a/how-many-times.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.
- Author: Graham Mitchell
- Filename: HowManyTimes.java
How Many Times?
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 count the number of times the item is found.
Array: 45 39 32 12 44 50 26 42 16 20 Value to find: 42 42 was found 1 times.
Array: 45 39 32 12 44 50 26 42 16 20 Value to find: 43 43 was found 0 times.
Array: 24 30 31 24 32 33 34 24 35 36 Value to find: 24 24 was found 3 times.
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK