C++ Program to perform addition of two numbers using pointers [DEVCPP/GCC]

PROGRAM

//Program to perform addition of two numbers using pointers

#include <iostream>

using namespace std;

int main()
{
int x,y,sum;

cout<<"ENTER FIRST NUMBER: ";
cin>>x;
cout<<"ENTER SECOND NUMBER: ";
cin>>y;

int *p1=&x;
int *p2=&y;

sum= (*p1)+(*p2);

cout<<"SUM OF "<<x<<" AND "<<y<<" IS "<<sum;
return 0;
}

OUTPUT

C++ Program to perform addition of two numbers using pointers with output


C++ Program to perform addition of two numbers using pointers with output

Share this

Related Posts

FIND US ON FACEBOOK!