Advertisement
tei123

js2

Sep 9th, 2016
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. var tab1 = new Array;
  2. var tab2 = new Array;
  3. var l=0;
  4. var s1=0;
  5. var s2=0;
  6. var snp=0;
  7. var lp=0;
  8. var max=0;
  9. var min=101;
  10.  
  11.  
  12. for (var i=0; i<10; i++)
  13.  
  14.  
  15. {
  16. tab1[i]= (Math.floor (Math.random()* 10));
  17. tab2[i]= (Math.floor (Math.random()* 10));
  18.  
  19. s1+=tab1[i];
  20. s2+=tab2[i];
  21.  
  22. if(tab1[i]!=tab2[i])
  23. l++
  24.  
  25.  
  26. }
  27.  
  28. for (var i=0; i<10; i++)
  29. document.write(tab1[i]+" ");
  30. document.write("<br>");
  31. for (var i=9; i>=0; i--)
  32. document.write(tab1[i]+" ");
  33. document.write("<br>");
  34.  
  35. for (var i=0; i<10; i++)
  36. document.write(tab2[i]+" ");
  37. document.write("<br>");
  38.  
  39. for (var i=9; i>=0; i--)
  40. document.write(tab2[i]+" ");
  41. document.write("<br>");
  42.  
  43.  
  44. if(l!=0)
  45. document.write("tabele sa rozne"+"<br>");
  46. else document.write("tabele sa takie same"+"<br>");
  47.  
  48. document.write("suma 1 tabeli "+s1+"<br>");
  49. document.write("suma 2 tabeli "+s2+"<br>");
  50.  
  51.  
  52.  
  53. if(s1==s2)
  54. document.write("Tablice sa takie same"+"<br>");
  55. else document.write("Tablice sa rozne"+"<br>");
  56.  
  57.  
  58.  
  59. if(s1!=s2){
  60. do{
  61. if(s1>s2)
  62. s1-=s2;
  63. else
  64. s2-=s1;
  65.  
  66. } while (s1!=s2);
  67. document.write("najwiekszy wspolny dzielnik "+s1+"<br>");
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement