Solve me first : Hacker Rank Problem Solution

Solve me first : Hacker Rank Problem Solution


C Implementation:


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

/* function to compute sum of received two numbers */
int solveMeFirst(int a, int b) 
{
  return a+b;
}

int main() 
{
  int num1,num2;
  
  /* Get the two numbers from the user */
  scanf("%d %d",&num1,&num2);
  int sum; 
  
  /* store the result of the function call solveMeFirst in sum */
  sum = solveMeFirst(num1,num2);
  
  /* print the result, which is sum of entered two numbers */
  printf("%d",sum);
  return 0;
}

Python Implementation:

# function to get two number inputs & return their sum
def solveMeFirst(a,b):
  return a+b


# get the first number from the user
num1 = input()

# get the second number from the user
num2 = input()

# compute the sum of two numbers by calling function solveMeFirst
res = solveMeFirst(num1,num2)

# print the value of 'res' which is the sum of entered two numbers by the user
print res