CS Electrical And Electronics
@cselectricalandelectronics

Kotlin code to find maximum number using functions?

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

I need short information.

1 Answers
chetan shidling answered 3 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