diff --git a/Basic/TotalNumberOfParirsWhoseSumIsEqualToX.java b/Basic/TotalNumberOfParirsWhoseSumIsEqualToX.java new file mode 100644 index 0000000..fe058d4 --- /dev/null +++ b/Basic/TotalNumberOfParirsWhoseSumIsEqualToX.java @@ -0,0 +1,29 @@ +// write a code in java to find the total number of pairs whose sum is equal to a given number using function +import java.util.Scanner; +class TotalNumberOfParirsWhoseSumIsEqualToX{ + public static void main(String[] args){ + Scanner sc = new Scanner(System.in); + System.out.println("Enter the size of the array"); + int n = sc.nextInt(); + int[] arr = new int[n]; + System.out.println("Enter the elements of the array"); + for(int i=0;i