- 1

Hello can someone help me solve the challenges in kotlin?

I have completed all the modules, but I can't complete the projects in it, it has multiple test cases but I can't write code to solve all, the solution I write solve only one test case

17th Feb 2021, 10:17 PM
Code_wizard💯🔥
Code_wizard💯🔥 - avatar
12 Answers
+ 5
Code_wizard💯🔥 I have already explained it. Check my comments again. Don't solve blindly or with ready-made answers. You won't learn it. Re-read lessons again, if you don't understand.
17th Feb 2021, 11:05 PM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 4
Code_wizard💯🔥 You cannot declare variable starting with capital letter. var years = readLine()!!.toInt() => [means it's going to take input and convert into integer] When you are taking input, you don't need to assign consumption value of water. Here, you have to year [not consumption] You can solve it this way & it will give you correct output. ⬇️ var years = readLine()!!.toInt() println(years*365*15) //try to understand logic behind given problem. It will be easy to solve other problems // happy learning 👍
17th Feb 2021, 10:42 PM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 3
Share the problem description, along with your attempt of code
17th Feb 2021, 10:22 PM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 3
Code_wizard💯🔥 Did you understand logic behind solving the problem?
17th Feb 2021, 10:48 PM
Shivani 📚✍
Shivani 📚✍ - avatar
0
Ok This the problem: Each day a family consumes 15 liters of water. Given the number of years as input, you need to calculate and output the amount of water consumed in that period. Sample Input 5 Sample Output 27375 The water consumption in 5 years would be: 5*365*15 = 27375 //Default code Var years =readLine()!!. toInt() // My code Var = consumption = 2*365*15 Println(consumption)
17th Feb 2021, 10:30 PM
Code_wizard💯🔥
Code_wizard💯🔥 - avatar
0
Thanks it worked👐
17th Feb 2021, 10:46 PM
Code_wizard💯🔥
Code_wizard💯🔥 - avatar
0
Not really... If you could explain a bit, that would be great
17th Feb 2021, 10:50 PM
Code_wizard💯🔥
Code_wizard💯🔥 - avatar
0
fun main(args: Array<String>) { var years =readLine()!!. toInt() println(you don't need assign consumption o water that could be year's no need to specially mentioning year's too your TIP in this section only) }
9th Apr 2021, 4:56 AM
Ravi venkateswarlu
Ravi venkateswarlu - avatar
0
it's a quite simple!! fun main(args: Array<String>) { var years = readLine()!!.toInt() var consuption = years*15*365 println(consuption) }
12th Apr 2021, 11:15 AM
Madhavi Patel
Madhavi Patel - avatar
0
fun main(args: Array<String>) { var years = readLine()!!.toInt() var res = years*365*15 println(res) }
7th May 2021, 11:41 AM
Alharith Yousif
Alharith Yousif - avatar
0
fun main(args: Array<String>) { var years = readLine()!!.toInt() var consumation= years*365*15 //logic println(consumation) }
30th May 2021, 6:48 AM
Akshay jain
0
IT WORKED: fun main(args: Array<String>) { var years = readLine()!!.toInt() var consuption = years*15*365 println(consuption) }
7th Dec 2021, 1:30 PM
Mirmahmud Ilyosov
Mirmahmud Ilyosov - avatar