write a c++ fragment to display the elements in the even positions of the array: float val [100];
Answers
Answered by
1
Answer:
Explanation:
#Initialize array
arr = [1, 2, 3, 4, 5];
print("Elements of given array present on even position: ");
#Loop through the array by incrementing the value of i by 2
#Here, i will start from 1 as first even positioned element is present at position 1.
for i in range(1, len(arr), 2):
print(arr[i]);
Similar questions
Business Studies,
3 hours ago
Computer Science,
3 hours ago
CBSE BOARD XII,
3 hours ago
English,
5 hours ago
Physics,
5 hours ago
Math,
7 months ago
Math,
7 months ago