write a program in java to input three numbers and print max and min
Answers
For the sake of simplicity, we can assume that we are dealing with integers as the number can be floating point also, but you should always get clarified what kind of data you are dealing with, as they are very important to find the right solution. A function that works fine for integer not necessary work for long or float, especially in a production environment.
Now, another question is how do you pass those three numbers? Well, you can either write the Unit test or you can pass three numbers from the console or directly and then print. The first one is completely programmatic and a better approach, but the second one is interactive and good when you are learning. Since the problem is simple, I'll follow the second approach here.
Btw, you also need to decide which programming language you are going to solve the problem. If you know Python well, you can solve it in Python or if you are a C++ programmer you can solve in C++, there is no restriction on that.
Since I am a Java developer, I'll solve this problem in Java. I assume that you know the basics of Java, but if you don't, you should first go through a good Java course like The Complete Java Masterclass on Udemy before solving Coding problems. Just like we learn the Alphabet first before learning speaking or writing.