Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var tab1 = new Array;
- var tab2 = new Array;
- var l=0;
- var s1=0;
- var s2=0;
- var snp=0;
- var lp=0;
- var max=0;
- var min=101;
- for (var i=0; i<10; i++)
- {
- tab1[i]= (Math.floor (Math.random()* 10));
- tab2[i]= (Math.floor (Math.random()* 10));
- s1+=tab1[i];
- s2+=tab2[i];
- if(tab1[i]!=tab2[i])
- l++
- }
- for (var i=0; i<10; i++)
- document.write(tab1[i]+" ");
- document.write("<br>");
- for (var i=9; i>=0; i--)
- document.write(tab1[i]+" ");
- document.write("<br>");
- for (var i=0; i<10; i++)
- document.write(tab2[i]+" ");
- document.write("<br>");
- for (var i=9; i>=0; i--)
- document.write(tab2[i]+" ");
- document.write("<br>");
- if(l!=0)
- document.write("tabele sa rozne"+"<br>");
- else document.write("tabele sa takie same"+"<br>");
- document.write("suma 1 tabeli "+s1+"<br>");
- document.write("suma 2 tabeli "+s2+"<br>");
- if(s1==s2)
- document.write("Tablice sa takie same"+"<br>");
- else document.write("Tablice sa rozne"+"<br>");
- if(s1!=s2){
- do{
- if(s1>s2)
- s1-=s2;
- else
- s2-=s1;
- } while (s1!=s2);
- document.write("najwiekszy wspolny dzielnik "+s1+"<br>");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement