Computer Science, asked by YoungNino01, 8 months ago

if an element in an array is even print out its position using c language

Answers

Answered by samikshagosavi2505
0

Answer:

Here's your answer

Explanation:

In this program, we need to print the element which is present on even position. Even positioned element can be found by traversing the array and incrementing the value of i by 2.

In the above fig array, elements on even position are b and d.

  • STEP 1: STARTSTEP 2)INITIALIZE arr[] = {1, 2, 3, 4, 5}STEP 3)length= sizeof(arr)/sizeof(arr[0]) STEP 4) PRINT "Elements of given array present on even position:" STEP 5) i=1. REPEAT STEP 6 and STEP 7 UNTIL i<length STEP 6)PRINT arr[i] STEP 7) i=i+2 STEP 8) RETURN 0. STEP 9)END.

Hope it helps you

Mark me as Brainlist...

Attachments:
Similar questions