Can someone please help me out!!!I included what I have so far.
*Purpose
Implement a Java-method with three local int variables a, b, c, d and e that sorts these three values in ascending order by comparing and exchanging their values. At the end of the program a <= b <= c <= d <= e must hold.
2 answers
I think you need to suggest some code first for us to comment on.
import java.util.Scanner;
public class Q3 {
public static void main(String[] args) throws Exception
{
int A,B,C,D;
String result;
Scanner reader= new Scanner(System.in);
System.out.print("Enter value A : ");
A=reader.nextInt();
System.out.print("Enter value B :");
B=reader.nextInt();
System.out.print("Enter value C :");
C=reader.nextInt();
if (A>B)
D=A;
A=B;
B=D;
{
System.out.println("Results is ");
}
}
}
public class Q3 {
public static void main(String[] args) throws Exception
{
int A,B,C,D;
String result;
Scanner reader= new Scanner(System.in);
System.out.print("Enter value A : ");
A=reader.nextInt();
System.out.print("Enter value B :");
B=reader.nextInt();
System.out.print("Enter value C :");
C=reader.nextInt();
if (A>B)
D=A;
A=B;
B=D;
{
System.out.println("Results is ");
}
}
}