+ 3
How to use else if with a function?
for example when you want a user to input his or her age and using the function to interact with the code.,,,like int x =10 if (x <=0) it should print error and so on....I want the int should be user input not fixed? help guys thanks in advance
4 Réponses
+ 8
You'll get help from this lesson on how to take user input in Java: https://www.sololearn.com/learn/Java/2220/
Also, here's a sample code for your convenience:
https://code.sololearn.com/cMylYdRgkNft/?ref=app
Hope it helps :)
+ 4
The question is not clear enough. From the description I can assume that you're trying to take user input. Which programming language are you using?
+ 3
java
+ 2
You need to read input stream from keyboard and assign that value to x.