0
Please Convert The Python Code To Java Script Code
x=int(input("Enter the total number of people: ")) def publicBusFare(x): a=(x//50) b=(x-a*50)//11 c=(x-a*50-b*11) pbf=c*250 print(pbf) publicBusFare(x)
1 Answer
+ 3
// JS
function publicBusFare(x) {
let a = Math.floor(x/50);
let b = Math.floor((x-a*50)/11);
let c = x-a*50-b*11;
let pbf = c*250;
document.write(pbf);
console.log(pbf);
}
window.onload = () => {
var distance = prompt("Enter the total number of people: ", "0");
publicBusFare(Number(distance));
}