Hello friends! Welcome to my website
Java programming to find the biggest and the smallest number between two numbers?
This Java language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.
Output:
Please Enter first number: 12
Please Enter second number: 15
Please Enter third number: 11
---------------
15 is biggest than 12 and 11
---------------
11 is smallest than 12 and 15
I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this Java programming code or input & output please comment below
If you have another question about Java programming send an email by contacting us form are given on the page right side.
Please share your experience about this post,
Thank You!
Java programming to find the biggest and the smallest number between two numbers?
This Java language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.
Find the Biggest and smallest number from three given numbers in java
import java.util.Scanner;
class test {
int a, b, c;
public void biggest(int a, int b, int c) {
if (a > b && a > c) {
System.out.println(a+" is "+" biggest than "+b+" and "+c);
}
else if (b > a && b > c) {
System.out.println(b+" is "+" biggest than "+a+" and "+c);
}
else{
System.out.println(c+" is "+" biggest than "+a+" and "+b);
}
}
public void smallest(int a, int b, int c) {
if (a System.out.println(a+" is "+" smallest than "+b+" and "+c);
}
else if (b System.out.println(b+" is "+" smallest than "+a+" and "+c);
}
else{
System.out.println(c+" is "+" smallest than "+a+" and "+b);
}
}
}
public class biggest {
public static void main(String[] args) {
test o = new test();
Scanner c = new Scanner(System.in);
System.out.print("Please Enter frsit number: ");
o.a= c.nextInt();
System.out.print("Please Enter second number: ");
o.b= c.nextInt();
System.out.print("Please Enter third number: ");
o.c= c.nextInt();
System.out.println("---------------");
o.biggest(o.a, o.b, o.c);
System.out.println("---------------");
o.smallest(o.a, o.b, o.c);
}
}
int a, b, c;
public void biggest(int a, int b, int c) {
if (a > b && a > c) {
System.out.println(a+" is "+" biggest than "+b+" and "+c);
}
else if (b > a && b > c) {
System.out.println(b+" is "+" biggest than "+a+" and "+c);
}
else{
System.out.println(c+" is "+" biggest than "+a+" and "+b);
}
}
public void smallest(int a, int b, int c) {
if (a System.out.println(a+" is "+" smallest than "+b+" and "+c);
}
else if (b System.out.println(b+" is "+" smallest than "+a+" and "+c);
}
else{
System.out.println(c+" is "+" smallest than "+a+" and "+b);
}
}
}
public class biggest {
public static void main(String[] args) {
test o = new test();
Scanner c = new Scanner(System.in);
System.out.print("Please Enter frsit number: ");
o.a= c.nextInt();
System.out.print("Please Enter second number: ");
o.b= c.nextInt();
System.out.print("Please Enter third number: ");
o.c= c.nextInt();
System.out.println("---------------");
o.biggest(o.a, o.b, o.c);
System.out.println("---------------");
o.smallest(o.a, o.b, o.c);
}
}
Output:
Please Enter first number: 12
Please Enter second number: 15
Please Enter third number: 11
---------------
15 is biggest than 12 and 11
---------------
11 is smallest than 12 and 15
I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this Java programming code or input & output please comment below
If you have another question about Java programming send an email by contacting us form are given on the page right side.
Please share your experience about this post,
Thank You!