+ 4
Java Boiling Water Solution
Hey guys! I'm having trouble with the Java boiling water program. This is my code. import java.util.Scanner; public class Program{ public static void main(String[]args){ Scanner sc =new Scanner(System.in); int temp = sc.nextInt; if(temp>=100){ System.out.println("Boiling'"); } else { System.out.println("Not Boiling"); } } } Kindly requesting for assistance.
3 Antworten
+ 8
int temp = sc.nextInt(); // missing ()
+ 3
Ans correct
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int temp = sc.nextInt(); // Corrected method name
if(temp>=100) {
System.out.println("Boiling");
}else{
System.out.println("Not boiling");
}
}
}
+ 2
Thanks. The code worked ✨