What is the syntax for - To find smaller between two numbers. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the syntax for - To find smaller between two numbers.

In java bluej

5th Dec 2017, 2:01 PM
DrPrem Prakash Purohit
DrPrem Prakash Purohit - avatar
2 Answers
+ 6
Without any functions: if(num1 < num2) { System.out.println(num1) } else { System.out.println(num2) }
5th Dec 2017, 2:25 PM
Cool Codin
Cool Codin - avatar
+ 2
Use Math.min function.... Example : int num1=5; int num2=10; System.out.print(Math.min(num1,num2)); //Outputs 5
5th Dec 2017, 2:07 PM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar