Challenge 18: Write a function to compute the sum of 2 numbers of any numeric type?
To perform effectively as a software application developer, one must be acquainted with various facets application development. To test the skills of application developers, Superior Consulting Services (SCS) offers a series of technical coding challenges designed to challenge and educate application developers. This blog addresses application programming and presents SCS’ eighteenth (18th) challenge: Write a function to compute the sum of two numbers of any numeric type?
Let’s get ready to rumble… C# Style
Each SCS challenge will require the user to solve a problem and present their approach through a coded solution. All questions are designed to be solvable by mid-level application developers in one hour or less. The 18th challenge is shown below.
C# provides the following numeric data types.
Write the most compact function to accurately compute the sum of two numbers.
- Numbers can be any numeric data type.
- Numbers passed to function can be of similar (double, double) or mixed type (i.e. int and double)
- Each number must be within the range of <= 1000 and >= -1000.
The winner will provide the smallest and most accurate function to compute the total.
- The winner will provide the smallest function as measured by lines of code and statement length.
- Contestant challenge submittals should be emailed to email@example.com, Subject Line SCS Coding Challenge #18.
- Reponses to Challenge #18 should be received by 5:00 pm CDT, August 31st, 2016.
- In the event of a tie between two or more winning solutions, the first solution received will receive the prize; however, all submitters with correct solutions will be recognized.
- Employees of SCS are not eligible to participate in the coding challenge.
The best solution submitted will receive an Amazon.com gift certificate worth $25.00 (U.S. dollars) and have the winning solution, along with the winner’s name, on the SCS website: www.teamscs.com.