daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Mar 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. object GreatestDivisor {
  2.   def main(args: Array[String]){
  3.     var list2 = args
  4.  
  5.     for (j <- 0 to list2.length-1) {
  6.       if (scala.util.Try(list2(j).toInt).isFailure){
  7.         println(list2(j) + " : the conversion is not possible")
  8.       }
  9.       else if (scala.util.Try(list2(j).toInt).isSuccess){
  10.         print(list2(j).toInt + " : ")
  11.         GetDivisor(list2(j).toInt)
  12.       }
  13.     }
  14.   }
  15.  
  16.   def GetDivisor(y: Int): Unit = {
  17.     for (i <- 1 to y){
  18.       if (y.toFloat/(y.toFloat-i) == math.floor(y.toFloat/(y.toFloat-i))) {
  19.         return (println(y-i))
  20.       }
  21.     }
  22.   }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top