0
Java Conditionals (Failing need help)
The practice wont let me finish it despite the fact that it is 100% correct code. import java.util.Scanner; public class Program { public static void main(String[] args) { int temperature = 33; if(temperature >= 100){ System.out.println("Boiling"); }else{ System.out.println("Not boiling"); } } }
1 Answer
+ 7
Don't hardcode the temperature.
Take it as an input.
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int temperature = sc.nextInt();
if(temperature >= 100)
System.out.println("Boiling");
else
System.out.println("Not boiling");
}
}