Computer Science, asked by nitishn3550, 1 year ago

Write a program to find sum of two numbers using classes and objects

Answers

Answered by gurukulamdivya
6

Answer:

#include<iostream>

using namespace std;

class Add

{

public:

   int addition(int x, int y) {

       return x + y;

   }

};

int main()

{

   int x, y, s;

   cout << "Enter two numbers :";

   cin >> x >> y;

   Add obj;

   s = obj.addition(x, y);

   cout << "\nThe sum of two numbers is :" << s;

   return 0;

}

Similar questions