HACKERRANK 2

 Input Format

Input will contain two integers,  and , separated by a newline.

Sample Input

4
5

Sample Output

9
1

solution:


#include <stdio.h>
#include<iostream>
#include<cmath>
#include <cstdlib>
using namespace std;


int main() {
    int a, b ,c, d;
    cin>>a>>b;
    c=a+b;
    d=a-b;
    cout<<c<<endl;
    cout<<abs(d);
    
    return 0;
}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings