Question: Program should be written in C Problem 1: You are given an array of integers array[] and an input x. You have to find ifthere

Program should be written in C

Problem 1: You are given an array of integers array[] and an input x. You have to find ifthere are any two numbers in your array such that the sum of their square equals to x2. In otherwords, you have to find out if there is any pair of i,j such that array[i]2 + array[j]2 = x2.

If there are such pairs, you should print all such (i,j). Otherwise print There are no such pairs.

Example: array[]: 2, -4, 6, 3, 9, 0, -1, -9 x: 5 You have 1 pair: (-4)2 + (3)2 = 52, so your output would be corresponding array indices: (1, 3)

Note: The array size is 10 and you have to get the elements of the array from the user. You also need to take the value of x from the user.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!