Given a vector of integers and a real number find the closest integer.

EX:

>> a = [2 4 5 6 8 10];

>> b = 4.6;

>> nearestNumber(a,b)

ans=5

Solution Stats

782 Solutions

365 Solvers

Last Solution submitted on Jan 19, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...