Scala Program to Get the Base 10 Logarithm of a Double Number Using Scala.math.log10() Function

Scala program to get the base 10 logarithm of a Double number using scala.math.log10() function

// Scala program to get the base 10 logarithm of a 
// Double number using scala.math.log10() function

object Sample{  
    def main(args:Array[String]){  
        var num:Double    = 0;
        var res:Double = 0;
        
        print("Enter number: ")
        num=scala.io.StdIn.readDouble()
        
        res= scala.math.log10(num)
        println("Base 10 logarithm is: "+res);
    }
}

Output

Enter number: 23.4
Base 10 logarithm is: 1.3692158574101427
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment