C program to find the ceiling element of the given number in the sorted array
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Given a sorted array arr[] and a number item, the ceiling of the item is the smallest element in array arr[] greater than or equal to item. We have to find the ceiling value of the given number in the sorted array using C program.
Program:
The source code to find the ceiling element of the given number in the sorted array is given below. The given program is compiled and executed using GCC compile on UBUNTU 18.04 OS successfully.
Output:
Explanation:
Here, we created two functions FindCeilingItem() and main() function. The FindCeilingItem() function is a user-defined function, it is used to find the index of ceiling item of a given number from the given sorted array.
In the main() function, we created an array arr with 7 integer elements. Then we find the ceiling item of the given number item using the FindCeilingItem() function from array arr and then we printed the result on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer