Square root of an integer Problem

Problem Implement int sqrt(int x). OR Compute and return the square root of x. OR If x is not a perfect square, return floor(sqrt(x)) OR floor(√n) OR Given a non-negative integer x, compute and return the square root of x. Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned. ...

Linear Search Algorithm on array

Problem Given an array of n elements and a element ‘x’, write a program to search an element ‘x’ in the array. Examples // Example 1 Input [] = {20, 30, 40, 10, 5, 2, 60, 73}, int x = 10 Output: Index 3 // Example 2 Input [] = {20, 30, 40, 10, 5, 2, 60, 73}, int x = 60 Output: Index 6 // Example 3 Input [] = {20, 30, 40, 10, 5, 2, 60, 73}, int x = 9 Output: No Found ...

This site uses cookies to improve your experience on our website. By using and continuing to navigate this website, you accept this. Privacy Policy