سلام.
pascal

function RoundToNum(X: Integer; RoundParam : Integer = 10):Integer;
begin
Result := (X div RoundParam) * RoundParam;
if (((X - Result) * 2) > RoundParam) then
Result := Result + RoundParam;
end;

C++‎‎‎

int RoundToNum(int X, int RoundParam)
{
int Result = int(X / RoundParam) * RoundParam;
if (((X - Result) * 2) > RoundParam)
Result += RoundParam;
return Result;
};