Itwas on the quiz, I wasn’t able do that. give me the code withexplanations “in C language. “Complete the following main program such that it will prompt the user to enter an integer value and check whether the value is in array a[], then i. print out “Found!” followed by the index if the value is in all or ii. print out “Not found!” followed by the value in all which is the closest to the input value. For example, if user enters 12, output can be 3 or 6 (because a[3) – 12, a[6] – 12); if user enters -5, output will be 5 (because a[5] =-5); if user enters 20, output should be 17 (because 20 is not in af) and 17 is the closest to 20); if user enters 6, output can be either 2 or 10 (because 6 is not in aſ), and 2 and 10 are the closest to 6). Bonus (3 points): if you use only loop to accomplish this. int main() { int a[10] = 12, -3, 0, 12, 17, -5, 12, -9, 10, -15); Show transcribed image text Complete the following main program such that it will prompt the user to enter an integer value and check whether the value is in array a[], then i. print out “Found!” followed by the index if the value is in all or ii. print out “Not found!” followed by the value in all which is the closest to the input value. For example, if user enters 12, output can be 3 or 6 (because a[3) – 12, a[6] – 12); if user enters -5, output will be 5 (because a[5] =-5); if user enters 20, output should be 17 (because 20 is not in af) and 17 is the closest to 20); if user enters 6, output can be either 2 or 10 (because 6 is not in aſ), and 2 and 10 are the closest to 6). Bonus (3 points): if you use only loop to accomplish this. int main() { int a[10] = 12, -3, 0, 12, 17, -5, 12, -9, 10, -15);
Expert Answer
Answer to It was on the quiz, I wasn’t able do that. give me the code with explanations “in C language. “…