Wednesday, December 25, 2019

Solve Me First Hacker Rank Problem Solution

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: 2 + 3 = 5 

Solution:
#include<bits/stdc++.h>
using namespace std;
/*
*
* Siddharth Goyal
* Chandigarh Engineering College, Landran
*
*/

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

No comments:

Post a Comment

Staircase hackerrank Solution

Problem: Consider a staircase of size             #           ##     ###   #### Observe that its base and height are both equal to...