Please answer the following question with workSolutionProgra
Please answer the following question with work.
Solution
Program:
import java.io.*;
 import java.util.Scanner;
 class Input
 {
 public static void main(String args[])
 {
 int a,b,c;
 int x=0,y=0;
 Scanner data = new Scanner(System.in);
 System.out.println(\"Enter value for a \");
 a=data.nextInt();
 System.out.println(\"Enter value for b\");
 b=data.nextInt();
 System.out.println(\"Enter value for c\");
 c=data.nextInt();
 if(a==b)
 {
 x=a+c;
 y=2*a+c;
 }
 else if(a>b)
 {
 x=a-b+c;
 y=2*a-c;
 }
 else
 {
 x=1;
 y=1;
 }
 System.out.println(\"x = \"+x);
 System.out.println(\"y = \"+y);
 }
 }
Output:
Enter value for a
3
Enter value for b
3
Enter value for c
5
x = 8
y = 11
Output:
Enter value for a
8
Enter value for b
-7
Enter value for c
1
x = 16
y = 15
Output:
Enter value for a
0
Enter value for b
1
Enter value for c
2
x = 1
y = 1
Output:
Enter value for a
5
Enter value for b
4
Enter value for c
-5
x = - 4
y = 15
| a=3 | b=3 | c=5 | x=8 | y=11 | 
| a=8 | b= - 7 | c=1 | x=16 | y=15 | 
| a=0 | b=1 | c=2 | x=1 | y=1 | 
| a=5 | b=4 | c=- 5 | x= - 4 | y=15 | 
![Please answer the following question with work.SolutionProgram: import java.io.*; import java.util.Scanner; class Input { public static void main(String args[]) Please answer the following question with work.SolutionProgram: import java.io.*; import java.util.Scanner; class Input { public static void main(String args[])](/WebImages/8/please-answer-the-following-question-with-worksolutionprogra-995861-1761512541-0.webp)
![Please answer the following question with work.SolutionProgram: import java.io.*; import java.util.Scanner; class Input { public static void main(String args[]) Please answer the following question with work.SolutionProgram: import java.io.*; import java.util.Scanner; class Input { public static void main(String args[])](/WebImages/8/please-answer-the-following-question-with-worksolutionprogra-995861-1761512541-1.webp)
