Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function start()
  2. {
  3. var zahl= new Array (10);
  4. var h1 = new Array (10);
  5. var n, j;
  6. n=9;
  7. zahl[0] = 34;
  8. zahl[1] = 12;
  9. zahl[2] = 15;
  10. zahl[3] = 25;
  11. zahl[4] = 56;
  12. zahl[5] = 78;
  13. zahl[6] = 32;
  14. zahl[7] = 54;
  15. zahl[8] = 23;
  16. zahl[9] = 89;
  17.  
  18. for (j=n; j>=0; j--)
  19. {
  20.  
  21. max = j;
  22. for (i=0; i<n+1; i++)
  23. {
  24. if (zahl[i] > zahl[max])
  25.  
  26. {
  27.  
  28. max = i;
  29. }
  30. }
  31.  
  32. h1[j]=zahl[max];
  33. zahl [max] = zahl [max] * (-1);
  34. }
  35.  
  36. for (i=0; i< n+1; i++)
  37. {
  38. zahl[i]=h1[i]
  39. }
  40.  
  41. for (i=0; i< n+1; i++)
  42. {
  43. window.document.write(zahl[i]+"<BR>");
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement