Answer the question
In order to leave comments, you need to log in
Why doesn't the first assignment work in an if?
There is a code
package code;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner input = new Scanner(System.in)) {
int a;
int b;
int c;
int max;
System.out.println("Iput A");
a = input.nextInt();
System.out.println("Iput B");
b = input.nextInt();
System.out.println("Iput C");
c = input.nextInt();
max = a;
if (b > max) {
max = b;
}
if (c > max) {
max = c;
}
System.out.println("Max = " + max);
}
}
}
if(a > max) {
max = a;
}
if (b > max) {
max = b;
}
if (c > max) {
max = c;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question