ImportScala.mathValr = Math.randomValR1 = Math.randomValv = for(I <-0 until 1000)yield(math.random*1000). Round.tointValL10 = V.foldleft (0) (sum, v) = =if(v <100) sum+1ElseSum + 0)ValL20 = V.foldleft (0) (sum, v) = =if(v >=100 && v<200) sum+1ElseSum + 0)ValL30 = V.foldleft (0) (sum, v) = =if(v >=200 && v<300) sum+1ElseSum + 0)ValL40 = V.foldleft (0) (sum, v) = =if(v >=300 && v<400) sum+1ElseSum + 0)Vall50 = V.foldleft (0) (sum, v) = =if(v >=400 && v<500) sum+1ElseSum + 0)Vall60 = V.foldleft (0) (sum, v) = =if(v >=500 && v<600) sum+1ElseSum + 0)ValL70 = V.foldleft (0) (sum, v) = =if(v >=600 && v<700) sum+1ElseSum + 0)Vall80 = V.foldleft (0) (sum, v) = =if(v >=700 && v<800) sum+1ElseSum + 0)ValL90 = V.foldleft (0) (sum, v) = =if(v >=800 && v<900) sum+1ElseSum + 0)
val l100 = v.foldleft (0) (sum, v) = if(v >=900) sum+1 else sum + 0)
L10:int = L20:int = L30:int = L40:int = 103 L50:int = All L60:int = L70:int = 104 L80:int = l90:i NT = 109 L100:int = 108