Hi guys, could anyone tell me why it tells me something is wrong with my BufferedReader? I have been using this often and it hasn't said anything until now so I guess it might be something else?
Also I return the media already but it says I have to add a return type. I don't really understand.
package fr.codegym.task.task05.task0507;
/*
Moyenne arithmétique
*/
public class Solution {
public static void main(String[] args) throws Exception {
calculateMedia();
}
public static calculateMedia() {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
int i;
while (true) {
if (nb-1) {
float media = (float) sum / i;
return media;
break;
}
int nb = r.readLine();
i++;
int sum = sum+nb;
}
}
}