Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-------------------------------------------
- // LAB-01 ИНТЕРНЕТ ПРОГРАМИРАЊЕ
- //-------------------------------------------
- // Proveruva dali e 3 cifreniot broj palindrom
- num = prompt("Vnesi 3 cifren broj: ");
- while( num.length != 3 || isNaN(num) )
- num = prompt("Vnesi 3 cifren broj: ");
- if( Math.floor(num / 100) == num % 10 )
- alert("Nice Job.");
- //-------------------------------------------
- // Prikaz na tel. broj i od koj operator e
- phone = prompt("Vnesi telefonski broj: ");
- while(phone.length != 8)
- phone = prompt("Vnesi telefonski broj: ");
- phone = "0" + phone.slice(0,2) + "/" + phone.slice(2, 5) + "-" + phone.slice(5);
- op = phone.slice(1,3);
- operator = "";
- switch(parseInt(op)) {
- case 70:
- case 71:
- case 72:
- operator = " T-mobile";
- break;
- case 75:
- case 76:
- operator = " One";
- break;
- case 77:
- case 78:
- operator = " Vip";
- break;
- }
- phone = phone + operator;
- alert("Your phone number is: " + phone);
- // -------------------------------------------
- // Find max len word in string
- string = prompt("Your string: ");
- string = string.split(" ");
- max = "";
- for( word of string )
- if (word.length > max.length)
- max = word;
- alert(max);
- // -------------------------------------------
- // Find the sign of the product of given numbers
- numbers = prompt("Numbers: ");
- numbers = numbers.split(",");
- sign = 1;
- for(num of numbers){
- if(num < 1)
- sign *= -1;
- }
- if(-1 == sign)
- alert("-");
- else
- alert("+");
- // -------------------------------------------
- // Paren - neparen broj.
- for(i = 0; i < 31; i++) {
- if(i % 2 == 0)
- document.write("<p>" + i + " e paren broj.</p>");
- else
- document.write("<p>" + i + " e neparen broj.</p>");
- }
- // -------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement