+ 3

How can we add two variable in c++ programming

2nd Apr 2018, 11:46 AM
Gurchan
Gurchan - avatar
7 Answers
+ 2
Martin Taylor int x = std::rand(); int y = std::rand(); if (0 >= (x += y)) x = INT_MAX;
3rd Apr 2018, 2:03 PM
non
+ 4
int a = 5; int b = 7; int c = a+b;
2nd Apr 2018, 11:49 AM
Alex
Alex - avatar
+ 4
There is a sample in this lesson: https://www.sololearn.com/learn/CPlusPlus/1607/
2nd Apr 2018, 11:52 AM
Paul
Paul - avatar
+ 2
#include <iostream> using namespace std; int main() { int num1 = 17; int num2 = 25; int sum = num1 + num2; //outputs 42 (the meaning to life, the universe, and everything!) cout << sum << endl; return 0; }
2nd Apr 2018, 12:06 PM
Garret Johnson
Garret Johnson - avatar
0
No example used inputs *cough*
2nd Apr 2018, 5:42 PM
Alex
Alex - avatar