Learn basic concept of c , c++ and python programming in regularcodes.com

Spread the post

Program to print the alternate elements in an array

Every second element of array are alternate element.Suppose array are contain following element.

Stack Areamainarray [0] 1 [1] 2 [2] 3 [3] 4 [4] 5 [5] 6 [6] 7 [7] 8 [8] 9size (int) =9

Our goal is print alternate element of this given array.

Stack AreamainarrayALT [0] 1 [0] 1 [1] 2 [2] 3 [2] 3 [3] 4 [4] 5 [4] 5 [5] 6 [6] 7 [6] 7 [7] 8 [8] 9 [8] 9size (int) =9

Accepted result


Algorithm:

Iterative C program to Print Alternate node element.


Output


View all execution process.

Try it Yourself

Spread the post

Recommended Posts: