Skip to content
  • Home
  • Contact Us
  • About Us
  • Privacy Policy
  • DMCA
  • Linkedin
  • Pinterest
  • Facebook
thecscience

TheCScience

TheCScience is a blog that publishes daily tutorials and guides on engineering subjects and everything that related to computer science and technology

  • Home
  • Human values
  • Microprocessor
  • Digital communication
  • Linux
  • outsystems guide
  • Toggle search form
HackerRank Solve Me First Problem Solution

HackerRank Solve Me First Problem Solution

Posted on April 9, 2023April 9, 2023 By Yashwant Parihar No Comments on HackerRank Solve Me First Problem Solution

In this post, We are going to solve HackerRank Solve Me First Problem. We need to Complete the function solveMeFirst to compute the sum of two integers.

Example

a=7

b=3

Return 10

Function Description

Complete the solveMeFirst function in the editor below.

solveMeFirst has the following parameters:

  • int a: the first value
  • int b: the second value

Returns

  • int: the sum of a and b
HackerRank Solve Me First Problem Solution
HackerRank Solve Me First Problem Solution

Table of Contents

  • Solve Me First Python Solution
  • Solve Me First Java Solution
  • Solve Me First C Solution
  • Solve Me First C++ Solution
  • Solve Me First Javascript Solution
  • Solve Me First C Sharp Solution

Solve Me First Python Solution

#!/usr/bin/env python

import sys


if __name__ == '__main__':
    A = int(sys.stdin.readline())
    B = int(sys.stdin.readline())
    print(A + B)

Solve Me First Java Solution

import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner scan=new Scanner(System.in);
        int a=scan.nextInt();
        int b=scan.nextInt();
        int c=a+b;
        System.out.println(c);
    }
}

Solve Me First C Solution

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>


int solveMeFirst(int a, int b) {
  return a+b;
}
int main() {
  int num1,num2;
  scanf("%d %d",&num1,&num2);
  int sum; 
  sum = solveMeFirst(num1,num2);
  printf("%d",sum);
  return 0;
}

Solve Me First C++ Solution

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int solveMeFirst(int a, int b)
{
    return a + b;
}

int main()
{
    int num1, num2;
    int sum;
    cin>>num1>>num2;
    sum = solveMeFirst(num1,num2);
    cout<<sum;
    return 0;
}

Solve Me First Javascript Solution

process.stdin.resume();
process.stdin.setEncoding('ascii');

var __input_stdin = "";
var __input_stdin_array = "";
var __input_currentline = 0;

process.stdin.on('data', function (data) {
    __input_stdin += data;
});

function solveMeFirst(a, b) {
    return a+b;
}
process.stdin.on('end', function () {
    __input_stdin_array = __input_stdin.split("\n");
    var res;
    var _a = parseInt(__input_stdin_array[__input_currentline].trim(), 10);
    __input_currentline += 1;
    
    var _b = parseInt(__input_stdin_array[__input_currentline].trim(), 10);
    __input_currentline += 1;
    
    res = solveMeFirst(_a, _b);
    process.stdout.write(""+res+"\n");
    
});

Solve Me First C Sharp Solution

using System;
using System.Collections.Generic;
using System.IO;
class Solution {
    static int solveMeFirst(int a, int b) { 
        return a+b;
    }
    static void Main(String[] args) {
        int val1 = Convert.ToInt32(Console.ReadLine());
        int val2 = Convert.ToInt32(Console.ReadLine());
        int sum = solveMeFirst(val1,val2);
        Console.WriteLine(sum);
    }
}      

Other Problems

  • HackerRank Simple Array Sum Problem Solution
  • HackerRank Compare the Triplets Problem Solution
c, C++, HackerRank Solutions, java, python Tags:C, cpp, Hackerrank Solutions, java, python

Post navigation

Previous Post: System Call in Linux
Next Post: HackerRank Simple Array Sum Problem Solution

Related Posts

HackerRank Super Reduced String Problem Solution HackerRank Super Reduced String Solution c
HackerRank Running Time of Algorithms Problem Solution HackerRank Running Time of Algorithms Solution c
HackerRank Count Luck Problem Solution HackerRank Count Luck Problem Solution c
HackerRank A Very Big Sum Problem Solution HackerRank A Very Big Sum Problem Solution c
HackerRank Fair Rations Problem Solution HackerRank Fair Rations Problem Solution c
HackerRank Insertion Sort - Part 1 Problem Solution HackerRank Insertion Sort – Part 1 Solution c

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Pick Your Subject
Human Values

Copyright © 2023 TheCScience.

Powered by PressBook Grid Blogs theme