How i add numbers in Array from keyboard | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How i add numbers in Array from keyboard

How can i input numbers or String in Array two or more times?Please give example. Thanks everybody:)

9th Apr 2017, 8:30 AM
Vuqar Samed
Vuqar Samed - avatar
4 Answers
+ 9
Using a loop. E.g. Assuming you have array of size 10, for (int i = 0; i < 10; i++) { //input to array[i] }
9th Apr 2017, 8:35 AM
Hatsy Rei
Hatsy Rei - avatar
+ 9
Yep. As @Button Masher said, it's a problem with C.Playground. If you want to do it on here, you'll have to insert data line by line with Scanner input.
9th Apr 2017, 8:48 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
Hatsy Rei But in Code Playgraund I cant add multiple numbers
9th Apr 2017, 8:38 AM
Vuqar Samed
Vuqar Samed - avatar
+ 2
That's because sololearn is designed to only take one input. Is simply won't work In code playground. Try it on your pc or different IDE
9th Apr 2017, 8:43 AM
Dextozz
Dextozz - avatar