Kotlin code to find maximum number using functions?

All QuestionsCategory: KotlinKotlin code to find maximum number using functions?
chetan shidling asked 4 years ago

I need short information.

1 Answers
chetan shidling answered 4 years ago

Here is the code:
 
fun main(args : Array<String>){
var max = max(41,22)
println(“The max is : $max”)
}
fun max(num1 : Int, num2 : Int): Int{
if(num1>num2)
return num1
else
return num2
}
 
Output:
 
The max is : 41