+ 1
chaosacid The OP code not taking input into account. The corrected code is already posted by others.. Here it is again... .. share your in separate thread if any trouble with code always ...
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int price = scanner.nextInt();
//complete the code
//int car_price = 11000; remove this
if( price <=12000 ) {
System.out.println("yes");
}
}
}
0
I'm typing all of this in but it still shows an error message.
0
its still wrong, why is it saying yes even if it inputs higher value like 15000.
- 1
Add the description in description place.. Question is cut off.
Where you are using input 'price'?
- 1
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int price = scanner.nextInt();
//complete the code
if(price <=12000) {
System.out.println("yes");
}
}
}
- 2
You have $12,000 to buy a car.
You're given a program which takes the price of car as an input.
- 2
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int price = scanner.nextInt();
//complete the code
if(price <=12000){
System.out.println("yes");
}
}
}