Q:

Write a JavaScript program to find the smallest round number that is not less than a given value

0

Write a JavaScript program to find the smallest round number that is not less than a given value. 
Note: A round number is informally considered to be an integer that ends with one or more zeros.[3] So, 590 is rounder than 592, but 590 is less round than 600

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

function nearest_round_number(num) {
    while (num % 10) {
        num++;
    }
    return num;
}

console.log(nearest_round_number(56));
console.log(nearest_round_number(592));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now