This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Buat sebuah function yang menerima input sebuah number. | |
Function tersebut akan mengembalikan sebuah array yang length nya sesuai dengan input di atas, | |
isi dari array tersebut adalah deretan bilangan kelipatan 3, | |
dengan syarat apabila habis dibagi dengan 5 cetak 'KAS' | |
dan apabila habis dibagi dengan 6 cetak 'KUS' | |
dan apabila bisa dibagi oleh angka 5 dan 6 cetak 'KASKUS'. Driver code : | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function enkripsi (input){ | |
var L = input.length | |
var data_before = [] | |
var data_after = [] | |
var square = 0 | |
var M = L | |
var result = [] | |
var check_string = true | |
// cek string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function to_roman(input) { | |
var romans = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']; | |
var decimals = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]; | |
var result_roman = ''; | |
var result_num = 0 | |
if(isNaN(input) === false){ | |
for(var i = 0 ; i < romans.length ; i++){ | |
while(input >= decimals[i]){ | |
result_roman += romans[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function munculSekali(input) { | |
input = input.toString() | |
var flag = 0 | |
var result = [] | |
for(var i = 0 ; i < input.length ; i++){ | |
flag = 0 | |
for(var j = 0 ; j < input.length ; j++){ | |
if(i !== j){ | |
if(input[i] !== input[j]){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fibonacci(n){ | |
if(n === 1){ | |
return [0] | |
}else{ | |
var s = fibonacci(n-1) | |
s.push(s[s.length - 1] + ((s.length === 1) ? 1 : s[s.length - 2])) | |
return s; | |
} | |
} | |
// 0 1 1 2 3 5 8 13 21 34 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webpackJsonp([1,2],{109:function(e,t,a){"use strict";function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];for(var a in t)void 0===e[a]&&(e[a]=t[a]);return e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},115:function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var result = []; | |
var count = 0; | |
var resultCount = []; | |
function longestBinaryGap(decimal) { | |
var divide = decimal / 2; | |
var divideRound = Math.floor(divide); | |
if (decimal % 2 != 0) { | |
count = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var result = []; | |
var count = 0; | |
var resultCount = []; | |
function decimalToBinary(decimal) { | |
var divide = decimal / 2; | |
var divideRound = Math.floor(divide); | |
decimal % 2 != 0 ? result.push(1) : result.push(0); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fractions = [100000, 50000, 20000, 10000, 5000, 1000, 500, 100, 50]; | |
var result = []; | |
var noFractionValue; | |
function doCheckNoFraction(input) { | |
return input < fractions[fractions.length-1] | |
} | |
function doCalculate(input) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2019-01-22T04:16:46.206Z","extensionVersion":"v3.2.4"} |
OlderNewer