You are on page 1of 1

/******************************************************************************

Welcome to GDB Online.


GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP,
Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS,
JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>

int fpon(int a[],int n,int sum)


{

int c=0;
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
if(a[i]+a[j]==sum)
c++;
}
}
return c;
}

int main()
{
int a[15];
int n,sum;

printf("enter the array length\n");


scanf("%d",&n);
printf("enter array elements\n");
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
printf("enter the sum value\n");
scanf("%d",&sum);

printf("the number of possible pairs are= %d",fpon(a,n,sum));

return 0;
}

You might also like