Question: *Program is in C* Write a program to find the smallest positive integer that does not appear in the array and cannot be formed by

 *Program is in C* Write a program to find the smallest

*Program is in C*

Write a program to find the smallest positive integer that does not appear in the array and cannot be formed by the sum of two numbers in an array. For this assignment implement the following function The function issumof2 returns 1 if the number is sum of 2 elements in the array data and returns 0 otherwise, size is the of elements in the array. The function returns 1 if the number appears in the array data and returns 0 otherwise, size is the number of elements in the array. An example is given in figure 1. 1, 2, 3 and 4 appear in this array. 4 can be formed as 4+1, 5 as 3+2, 6 as 3+3, 7 as 3+4 and 8 as 4+4 (it is ok to use a number twice). 9 does not appear in the array and it cannot be formed as sum of 2 numbers in the array. So, 9 is the solution for this array. Read an array of size 7 from the user, compute the smallest positive integer that does not appear in the array or cannot be formed by the sum of two numbers in an array, and print the result. Sample execution is given below

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!