Hi Guys in this article I would like to share with you how to use one dimensional array in Scala and how we can able to determine which of the values in our array is the smallest in terms of numerical value. The code is very short and easy to understand. I am using IntelliJ IDEA community edition 2017.2 edition as my text editor in writing this code. I hope you will find my work useful. Thank you very much for all the support in my website.I hope you will find my work useful and beneficial. If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360.Thank you very much and Happy Programming.Sample Program OutputProgram ListingSmallest.scalaobject Smallest { def main(args: Array[String]) { var listValues = Array(100,45,1240,12,50,531,62,376); print("\n\n"); print("Finding the Smallest Value Using Scala"); print("\n\n"); print("Written By: Mr. Jake R. Pomperada, MAED-IT"); print("\n\n"); for ( a <- listValues ) { print(" " + a + " "); } var smallest = listValues(0); for ( b <- 1 to (listValues.length - 1) ) { if (listValues(b) < smallest) smallest = listValues(b); } print("\n\n"); println("The Smallest Number in the list is " + smallest + "."); print("\n\n"); print("\t END OF PROGRAM"); print("\n\n"); }
Learn Computer Programming Free from our source codes in my website.
Sponsored Link Please Support
https://www.techseries.dev/a/27966/qWm8FwLb
https://www.techseries.dev/a/19181/qWm8FwLb
My Personal Website is http://www.jakerpomperada.com
Email me at jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Showing posts with label Finding the Smallest Value Using Scala. Show all posts
Showing posts with label Finding the Smallest Value Using Scala. Show all posts
Friday, August 25, 2017
Finding the Smallest Value Using Scala
Subscribe to:
Posts (Atom)