0

How to take input from user to use these value in if and else if condition directly...??? Help me

18th Feb 2017, 6:59 AM
AmanDeep Vashishtha
AmanDeep Vashishtha - avatar
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();
18th Feb 2017, 7:23 AM
Akshata
Akshata - avatar
+ 2
i ran your code it worked fine
18th Feb 2017, 7:48 AM
Akshata
Akshata - avatar
+ 2
maybe you didnt give right input
18th Feb 2017, 7:48 AM
Akshata
Akshata - avatar
+ 2
type the inputs on next line eg 30 1000
18th Feb 2017, 7:52 AM
Akshata
Akshata - avatar
+ 1
btw thnks again...
18th Feb 2017, 7:49 AM
AmanDeep Vashishtha
AmanDeep Vashishtha - avatar
0
ok.. thnks..👍👍
18th Feb 2017, 7:24 AM
AmanDeep Vashishtha
AmanDeep Vashishtha - avatar
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!"); } } } }
18th Feb 2017, 7:45 AM
AmanDeep Vashishtha
AmanDeep Vashishtha - avatar
0
maybe its not running in apk only...😅😅
18th Feb 2017, 7:48 AM
AmanDeep Vashishtha
AmanDeep Vashishtha - avatar