Solution (Extremely Basic) of URI online judge problem 1001 by c++

Read 2 variables, named A and B and make the sum of these two variables, assigning its result to the variableX. Print X as shown below. Print endline after the result otherwise you will get “Presentation Error”.

Input

The input file will contain 2 integer numbers.

Output

Print X according to the following example, with a blank space before and after the equal signal.

Sample Inputs Sample Outputs
10
9
X = 19
-10
4
X = -6
15
-7
X = 8

Solution:

#include<iostream>
using namespace std;
int main(){
int a, b, x;
cin>>a;
cin>>b;
x=a+b;
cout<<“X = “<<x<<endl;
return 0;
}

 

Advertisements
Categories: URI | Leave a comment

Post navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.