Showing posts with label Find all pair of elements whose sum is 25.. Show all posts
Showing posts with label Find all pair of elements whose sum is 25.. Show all posts

Wednesday, September 17, 2014

Find all pair of elements whose sum is 25.



#include<iostream>
using namespace std;
void main()
{
int abc[10];
int i;

cout<<"Enter values in array"<<endl;
for(i=0; i<10; i++)
{
cin>>abc[i];
}

for(i=0; i<10; i++)
{
for(int j=i; j<10; j++)
{
if((abc[i]+abc[j])==25)
{
cout<<"sum of  "<<abc[i]<<" and "<<abc[j]<<"is equal to"<<abc[i]+abc[j]<<endl;
}
}
}
}