0
How to take input from user to use these value in if and else if condition directly...??? Help me
8 Answers
+ 3
use scanner for the input
dont forget to use :
import java.util.scanner;
before the class at extreme top
Scanner sc = new Scanner(system.in);
in the main function
intialize a variable
assuming x
x = sc.nextInt();
+ 2
i ran your code it worked fine
+ 2
maybe you didnt give right input
+ 2
type the inputs on next line eg
30
1000
+ 1
btw thnks again...
0
ok.. thnks..đđ
0
whats wrong in this????
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter the age");
int age = sc.nextInt();
System.out.println("Enter money");
int money=sc.nextInt();
if (age > 18) {
if (money > 500) {
System.out.println("Welcome!");
}
}
}
}
0
maybe its not running in apk only...đ
đ