admin@onlinelearningcenter.in (+91) 7 999 01 02 03

Find if there is a pair with given sum

Kopal Jaiswal
315 Posts

WAP to print the pair in array which sums to a given number 'x'

Example1:

Input:

arr[]={10,1,15,3,8,16,8,0}

sum=16

 Output:

{1,15} {8,8} {16,0}

 Example 2:

Input:

arr[]= {4,7,12,56,34,87,36}

sum=42

 Output:

0

 

 

Since no pair is found

Published By : Kopal Jaiswal
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comments

Jquery Comments Plugin