Ford Motor Company Interview Question

I was asked how to print every nth element from an array.

Interview Answer

Anonymous

Jul 5, 2016

Take the mod of the number. For an array, iterate over it begining with i=0, and where ever i%number == 0 print array[i].

1