Solve Me First Solution in Java | HackerRank | Solve Me First HackerRank Solution


Solve Me First Solution in Java | HackerRank | Solve Me First HackerRank Solution

Hackerrank Algorithm's Solution

Solve Me First Solution in Java

Solve Me First HackerRank Solution in Java


Problem:

Complete the function solveMeFirst to compute the sum of two integers.

Function prototype:

int solveMeFirst(int a, int b);

where,

  • a is the first integer input.
  • b is the second integer input

Return values

  • sum of the above two integers

Sample Input

a = 2
b = 3

Sample Output

5

Explanation

The sum of the two integers  and  is computed as: .


https://www.hackerrank.com/challenges/solve-me-first/problem
Solve Me First HackerRank Solution in Java
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int solveMeFirst(int a, int b) { return a+b; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int a; a = in.nextInt(); int b; b = in.nextInt(); int sum; sum = solveMeFirst(a, b); System.out.println(sum); } }

Post a Comment

0 Comments