Computer Science, asked by sumankr8340278989, 10 months ago

Write a program in c ++ to add a two Number

Answers

Answered by sou86
3

Answer:

C++ programming code

#include <iostream>

using namespace std;

int main()

{

int a, b, c;

cout << "Enter two integers to add\n";

cin >> a >> b;

c = a + b;

cout <<"Sum of the numbers: " << c << endl;

return 0;

}

C++ addition program using class

#include <iostream>

using namespace std;

class Mathematics {

int x, y;

public:

void input() {

cout << "Input two integers\n";

cin >> x >> y;

}

void add() {

cout << "Result: " << x + y;

}

};

int main()

{

Mathematics m; // Creating an object of the class

m.input();

m.add();

return 0;

}

Answered by Mukeshgorain338
0

#include<iostream.h>

#include<conio.h>

void main()

{

int a,b,c;

cout<<"Enter the 1st number";

cin>>a;

cout<<"Enter the 2nd number";

cin>>b;

c=a+b;

cout<<"the sum ="<<c;

}

Plz mark it brainlist

Similar questions