Q. Program to print the elements of an array present on odd position.ExplanationIn this program, we need to print the elements of the array which are present in odd positions. This can be accomplished by looping through the array and printing the elements of an array by incrementing i by 2 till the end of the array is reached. In the above array, the elements which are on odd positions are a, c and e. Algorithm
SolutionPythonOutput: Elements of given array present on odd position: 1 3 5 COutput: Elements of given array present on odd position: 1 3 5 JAVAOutput: Elements of given array present on odd position: 1 3 5 C#Output: Elements of given array present on odd position: 1 3 5 PHPOutput: Elements of given array present on odd position: 1 3 5 Next Topic# |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India