1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| public class TeacherCal {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int note;
int nombreNote = 0;
// initialisation de mon tableau avec pour longueur le nombre de note
int[] array = new int[nombreNote];
do {
System.out.println("note :");
note = sc.nextInt();
for (int i = 0; i < array.length; i++)
nombreNote++;
System.out.println(" le tableau monTableau = " + note);
System.out.println(nombreNote);
} while (note != 0);
calMoyenne(note, nombreNote);
System.out.println();
} // end of main
private static void calMoyenne(int note, int nombreNote) {
double moyenne = note / nombreNote;
System.out.println(moyenne);
}
} |