Question description Malar is a First year student in reputed institution. Although he scored well in many subjects, he did not an expert in Algorithms. But malar's computer examination is scheduled for next week. As per the blueprint, many questions would come from the Arrays topic. He collected previous year's questions. one of the repeated questions is you need to find the pairs in Array with given sum. Can you help him ? Function Description
C Program


#include<stdio.h>

int main()

{

    int n;

    scanf("%d",&n);

    int array[n];

    int sum,count=0;

    for(int i=0; i<n; i++)

        scanf("%d",&array[i]);

    scanf("%d",&sum);

    for(int i=0; i<n; i++)

    {

        for(int j=i+1; j<n; j++)

        {

            if(array[i]+array[j]==sum)

            {

                printf("[%d %d]\n",array[i],array[j]);

                count++;

            }

        }

    }

    printf("Total Number of Pairs:%d",count);

    return 0;

}