Asked by Joyenna
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.
*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.
Answers
Answered by
Dr Russ
I think you need to suggest some code first for us to comment on.
Answered by
Mujahid
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 ");
}
}
}
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.