A number is called even if the number is divisible by 2 and is called odd if it is not divisible by 2. Given a number, we need to check whether it is odd or even in PHP....
Given a number, we need to check whether it is prime or not in PHP. General approach for prime check is discussed here. In this article we will learn about how to check if a number is prime or not in PHP....
Example: Let the input string be “i like this program very much”. The function should change the string to “much very program this like i”...
A perfect number is a number if it is equal to the sum of its factors,that is original number is equal to sum of all its factors excluding the number itself. We have already discuss how to check if a number is perfect or not in this article. In this article we will discuss about how to do the same in PHP....
Given a 2D square matrix, find the sum of elements in Principal and Secondary diagonals. For example, consider the following 4 X 4 input matrix....
Given a 2D square matrix, find the sum of elements in Principal and Secondary diagonals. For example, consider the following 4 X 4 input matrix....
Given a string, the task is to reverse the order of the words in the given string....
Given an array, the task is to find average of that array. Average is the sum of array elements divided by the number of elements....
Given a regular polygon with N sides. The task is to find the count of polygons that can be drawn from the given polygon by joining the vertices of the given polygon internally....
Example: Let the input string be “i like this program very much”. The function should change the string to “much very program this like i”...
Example: Let the input string be “i like this program very much”. The function should change the string to “much very program this like i”...
In C, the whole array cannot be passed as an argument to a function. However, you can pass a pointer to an array without an index by specifying the array’s name....