Computer Science, asked by sroy40622, 7 months ago

write a c++ program to display the sum of two integers taking input from the user​

Answers

Answered by purveshKolhe
4

\huge{\purple{\underline{\underline{\mathfrak{\red{\bigstar answer:: \bigstar }}}}}}

#include <iostream>

using namespace std;

int main() {

  int num1, num2;

  cin >> num1;

  cin >> num2;

  cout << num1 + num2;

  return 0;

}

\gray{\rule{300pt}{0.3em}}

\huge{\purple{\underline{\underline{\mathfrak{\red{\bigstar Logic:: \bigstar }}}}}}

  • First it includes an header file named iostream.
  • Then it declares that it is gonna use standard namespace.
  • Note that C++ ignores white spaces.
  • Then comes the main method.
  • We declare two integers called "num1", "num2".
  • Both integers take their respective inputs then.
  • We print the sum and finish the program.
  • "return 0" tells that the method is not gonna return anything.

\gray{\rule{300pt}{0.3em}}

Hope it helps..♪

Attachments:
Similar questions