Identify grammar/logic errors in the following codes and correct them.
(public class tstarray {
public static void main(string args[]){
int a[] = {5, 4, 9};
int avg;
int total;
for(int i=0; i< a.length; i++){
total = 0;
total += a[i];
}
avg = total/a.length;
}
}

Solved
Show answers

Ask an AI advisor a question