1. How to create an array of 5 or more numbers, find they average and standard dev? However, the user is to supply the numbers. 2. Is it possible to print items in an array in a single line? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

1. How to create an array of 5 or more numbers, find they average and standard dev? However, the user is to supply the numbers. 2. Is it possible to print items in an array in a single line?

I'm not lazy, lol, so I've tried, maybe I'm missing something cause wouldn't stop at the 5th no but its throwing an expectation: import java.util.Scanner; public class ScannerExample { public static void main(String[] args) { int num = 5; String[] Arr = new Di[num]; Scanner taker = new Scanner(System.in); for(int i=0; i<num; i++){ Arr[i] = taker.nextInt(); } System.out.println(names[i]); }} I was hoping this would print all the entered numbers for a start

17th Jun 2017, 2:34 PM
Lini Benson Jr
Lini Benson Jr - avatar
2 Antworten
+ 1
Maybe this will help. There were a few errors in variable names and types. Example: You cannot read an Integer into a string variable without converting it. I added a function that will put all the Array values into a String variable I hope this helps. https://code.sololearn.com/cNHN4yCj6PFM/?ref=app
17th Jun 2017, 3:17 PM
Limitless
Limitless - avatar
+ 1
I run the code with Int as array type, I however wrote it wrongly ere, thanks tho, I'll check yours out
17th Jun 2017, 8:21 PM
Lini Benson Jr
Lini Benson Jr - avatar