C++ मे, दो पूर्णांक जोड़ने के लिए प्रोग्राम लिखें ?
C++ प्रोग्राम
#include <iostream>
using namespace std;
int main()
{
int num1, num2, numsums;
cout << "Enter two integers: ";
cin >> num1 >> num2;
// sum two numbers in stored in variable numsums
numsums = num1 + num2;
// Prints sum
cout << num1 << " + " << num2 << " = " << numsums;
return 0;
}
Output
Enter two integers: 18
8
18 + 8 = 26
#include <iostream> using namespace std; int main() { int num1, num2, numsums; cout << "Enter two integers: "; cin >> num1 >> num2; // sum two numbers in stored in variable numsums numsums = num1 + num2; // Prints sum cout << num1 << " + " << num2 << " = " << numsums; return 0; }
Output
Enter two integers: 18 8 18 + 8 = 26