Solve Me First FP – HackerRank Solution

In this post, we will solve Solve Me First FP – HackerRank Solution. This problem (Solve Me First FP ) is a part of the HackerRank Functional Programming series. We are going to solve the HackerRank Functional Programming problems using Scala Programming Language.

Task

This is an introductory challenge. The purpose of this challenge is to give you a working I/O template in your preferred language. It includes scanning 2 integers from STDIN, calling a function, returning a value, and printing it to STDOUT.

Your task is to scan two numbers, A and B from STDIN, and print the sum A+B on STDOUT.

Note: The code has been saved in a template that you can submit if you want.

Input Format

You are given two integers, A and B on separate lines.

Output Format

Output an integer that denotes A + B

Constraints

1 <= A, B <= 1000

Sample Input

2
3

Sample Output

5

Solution – Solve Me First FP

object Solution {

    def main(args: Array[String]) {
        println(io.Source.stdin.getLines().take(2).map(_.toInt).sum)
    }
}

Note: This problem (Solve Me First Fp – HackerRank) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purposes.

Leave a Comment

Your email address will not be published.