answersLogoWhite

0


Best Answer

You can loop through the array, and print out every third element. If the index used for looping is called "i", you can test whether "i" is a multiple of three (i % 3 == 0).

Or, and perhaps more efficiently, you can increase the index 3 at a time, for example:

for (i = 0; i <= theArray.length, i+=3)

{

...

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which accepts an integer array of size n and prints every third value of the array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can you modify the bubble sort algorithm to search to sort an array of characters instead of array of integers?

The bubble sort algorithm can be applied to an array of characters. Every character can be translated to an integer equivalent via the ascii table


Program that prints every integer value from 1 to 20 along with its squared in java?

public class PrintValues { public static void main(String[] args) { for (int i = 1; i &lt;=20; i++) { System.out.println("Value is: " + i); int sq = i * i; System.out.println(i + " Squared is: " + sq); } } }


Can you help me with the C plus plus code of the program which has 10 index of array it adds 5 into every even elements of the array and then it subtracts 10 into the odd elements of the array?

int array[10] = {...}; for (int i = 0; i &lt; 10; ++i) { if (i % 2 == 0) array[i] += 5; else array[i] -= 10; }


What is an element in the Array?

An array is a container object that holds a fixed number of values of a single type. ... Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8.


What is the purpose of the dereference operator when used with a pointer variable?

Data type is mandatory in every variable-declaration.Example:int i; -- integerint *pi; -- integer-pointerint ai[10]; -- integer-arrayint *api[10]; -- array of integer-pointersint (*api)[10]; -- pointer to integer-array

Related questions

Can you modify the bubble sort algorithm to search to sort an array of characters instead of array of integers?

The bubble sort algorithm can be applied to an array of characters. Every character can be translated to an integer equivalent via the ascii table


Is every integer a rational number or is every rational number an integer?

Every integer is a rational number.


How do you write a java method to find the second largest integer in an array by using only one loop?

Use two variables to store the largest, and the second-largest integer. Update those in a loop, for every element in the array. Initial values might be the lowest permissible value for the int, long, double, or whatever value you use.


Is every integer iratinal?

Every integer is rational.


Is 1 a factor of every integer?

Yes, 1 is a factor of every integer and every integer is a multiple of 1.


Every negative number is an integer?

No, not every negative number is an integer. For example, -11/2 is not an integer. However, -1, -2, -3, and so on, are negative integers. Perhaps that is what you meant to ask. The negative of every positive integer is a negative integer.


Can every counting number be an integer?

YES. Every counting number is an integer.


What is true about every even integer?

There are many things that are ture about every even integer. For example: * An even integer divided by two will always result in an even integer.


Is every whole number an integer?

Yes.Yes. The definition of integer is basically 'a whole number.'


What is the difference between finger prints?

Nobody's finger prints are the same. Every person in the world has different finger prints. Even identical twins have different prints.


Is a counting number greater than every integer?

Every counting number IS an integer.


A negative integer times a positive integer equals what?

A negative integer. Every time.