+ 2
Please anyone help me, Tell me how can i input 5 integers in a code?? As i do " 5,12,32,45,11 " , its showing an error message!!
23 Réponses
+ 6
Modified your code MJ Tech
Sample input:
1
2
3
4
5
https://code.sololearn.com/czr378qDmt0C/?ref=app
+ 6
MJ Tech I have sent the solution, pls acknowledge
+ 6
MJ Tech your basic concepts are not clear
https://www.sololearn.com/learn/Java/2147/
+ 4
MJ Tech you removed the already existing things in the program.
Every new java project in SoloLearn has a class and the main method already defined
+ 3
Why is your array size only 1 when you want to input 5 values?
How to input array in java
MJ Tech check this code
https://code.sololearn.com/cWppfsdA6QRx/?ref=app
+ 2
MJ Tech for (int i=0 ; i<1; i++)
i<1 this makes the for loop to execute only once.
+ 1
MJ Tech Input in this format:
1
2
3
4
5
Different Inputs must be seperated by new line
EDIT: i < 4 (Wrong)
i < 5(Right)
ANOTHER EDIT: i < 4 will ask for input 4 times
i < 5 will ask for input 5 times
+ 1
MJ Tech You forgot a { after main()
like so
public static void main (String[] args){
+ 1
MJ Tech It would run if it was <= 4 but since it is < 4 it will only run until counter is 3. Thus , the input asked is 4 times
+ 1
MJ Tech See Namit Jain 's code
+ 1
+ 1
Hey your code is perfect the problem is in input type the input like this
1
2
3
4
5
0
rkk oh thanx sir to remind...but.. I did it 5 just now...again it shows error
0
rkk oh Thanx again...but it still gives error 'file not found...'
0
Ćheyat oh thanx bro...let me do it now
0
Ćheyat but see I initialized I by 0, so for 5 times it should run 0 to 4 !!
0
Ćheyat I did;
1
2
3
4
5
But again it showed ;
"error : file not found: /usercode/*.java
Usage : javac <options> <source files> use --help for a list of possible options "
0
Namit Jain ok thanks I understood... actually its first time I'm typing in this platform.....so I missed some elements
0
Ćheyat yes I understood, sorry it should be i =0; i <5 ; i ++...