- 2
Define two functions to print the maximum and the minimum number respectively among three numbers entered by user.
someone please write a program for this.
2 Antworten
+ 1
What do you have so far?
0
Since you didn't ask for a language here is Kotlin solution. You should be able to understand and code in your language of choice.
fun min(Int a, Int b, Int c) = if (a < b) if (a < c) a else if (b < c) b else c else if (b < c) b else c
fun max(Int a, Int b, Int c) = if (a > b) if (a > c) a else if (b > c) b else c else if (b > c) b else c