Write A C++ Program :sum Of Two Numbers?

5 Answers

Alongbar Daimary Profile
#include<iostream.h>
#include<conio.h>
void main(){
int a,b;
cout<<Enter Two numbers:";
cin>>a;
cin>>b;
cout<<"sum of two numbers are:" <<a+b;
getch();
}
mohit tyagi Profile
mohit tyagi answered
#include<iostream.h>
#include<conio.h>
main()
{
int a,b,sum;
cout<<"Enter Two numbers:";
cin>>a;
cin>>b;
sum=a+b;
cout<<"sum of two numbers are:" <<sum;
getch();
}
Anonymous Profile
Anonymous answered

#include <iostream>

using namespace std;

class Mathematics {
  int x, y;

public:
  Void input() {
    cout << "Input two inetegersn";
    cin >> x >> y;
  }

  void add() {
    cout << "Result = " << x + y;
  }

};

int main()
{
  Mathematics m; // Creating object of class

  m.input();
  m.add();

  return 0;
}

Answer Question

Anonymous