Q1. Write a program to add two numbers.

Sample#01

#include<iostream>
using namespace std;
int main()
{
    cout<<5+2;
    return 0;
}

Sample#02

#include<iostream>
using namespace std;
int main()
{
    int x=5,y=2;
    cout<<x+y;
    return 0;
}

Sample#03

#include<iostream>
using namespace std;
int main()
{
  int x,y;
  cout<<"Enter 1st Number:"; cin>>x;
  cout<<"Enter 2nd Number"; cin>>y;
  cout<<"x+y="<<x+y;
  return 0;
}

Sample#04

#include<iostream>
using namespace std;
int main()
{
  int x,y,z;
  cout<<"Enter 1st Number:"; cin>>x;
  cout<<"Enter 2nd Number"; cin>>y;
        z=x+y;
  cout<<"x+y="<<z;
  return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *