fork download
  1. #include<stdio.h>
  2. #define ARRAYGROESSE 8
  3. #define NICHT_GEFUNDEN -1
  4.  
  5. int main()
  6. {
  7. int GesZahl;
  8. int A[8]={2,5,9,18,23,34,36,99};
  9. int L=0, R=8, m;
  10.  
  11. printf("Gesuchte Zahl=");
  12. scanf(%d,&GesZahl);
  13.  
  14. while (R>=L) {
  15. m=(L+R)/2;
  16. if (GesZahl==A[m]) {
  17. printf("Index %d\n", m)
  18. }
  19. else if (GesZahl<A[m]) {
  20. R=m-1;
  21. }
  22. else {
  23. L=m+1;
  24. }
  25.  
  26. }
  27. printf("Nicht Gefunden!\n");
  28. return 0;
  29.  
  30. }
  31.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:12:8: error: expected expression before ‘%’ token
  scanf(%d,&GesZahl);
        ^
prog.c:17:27: error: expected ‘;’ before ‘}’ token
    printf("Index %d\n", m)
                           ^
                           ;
   }
   ~                        
stdout
Standard output is empty