Problem · Math

Adding Two Numbers

Learn this problem
EasyOracle logoOracleFULLTIMEOA

Problem statement

Determine the integer floor of the sum of two floating point numbers. The floor is the truncated float value, i.e., anything after the decimal point is dropped.

Function

addNumbers(a: float, b: float) → int

Complete the function addNumbers in the editor below.

addNumbers has the following parameter(s):

  1. float a: a floating point number
  2. float b: a floating point number

Returns

int: the floor of the sum of two floating point numbers

Examples

Example 1

a = 1.1b = 3.89return = 4
floor(1.1 + 3.89) = floor(4.99) = 4.

Constraints

  • 0.1 < a, b < 10^6
  • a and b have at most 8 places after the decimal

More Oracle problems

drafts saved locally
public int addNumbers(float a, float b) {
    // write your code here
}
a1.1
b3.89
expected4
checking account