CS Electrical And Electronics
@cselectricalandelectronics

How to convert double value into int value in Kotlin?

All QuestionsCategory: KotlinHow to convert double value into int value in Kotlin?
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 finalAmt = CalcAmount(553)
print(“The Amount is $finalAmt”)
}
fun CalcAmount(amt : Int) : Int{
return (amt + amt*0.04).toInt();
}
 
Output:
 
The Amount is 575