fork(1) download
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3.  
  4. #define NELEMS(x) (sizeof(x) / sizeof((x)[0]))
  5.  
  6. bool Meanvalue(int anzahl, int feld_noten[100], int *ausgabe){
  7. if (anzahl <= 0){
  8. return false;}
  9. int puffer = 0;
  10. int puffer1 = 0;
  11. for (int i = 0; i < anzahl; i++)
  12. {
  13. puffer = feld_noten[i];
  14. puffer1 = puffer + puffer1;
  15. }
  16. *ausgabe = puffer1 / anzahl;
  17. return true;
  18. }
  19.  
  20. int main(void) {
  21. // your code goes here
  22. //int size = 17;
  23. int feld_noten[] = { 100, 200, 300, 100, 200 };
  24.  
  25. int ergebnis = 0;
  26. Meanvalue(NELEMS(feld_noten), feld_noten, &ergebnis);
  27. printf ("%d", ergebnis);
  28.  
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
180