Here is the important part of the source code:
// 1: Given an integer array: The program must compute and write how many integers are greater than or equal to 10.
var arNums = [76,42,2,3,5,6,2,56,777,9,0,5,2,56,1];
var intsGTE10 = 0;
for(let i = 0; i < arNums.length; i++) {
if(arNums[i] >= 10) {
intsGTE10++;
}
}
Find more of these exerciseson (with solutions in C++) in wikibooks: https://en.wikibooks.org/wiki/C%2B%2B_Programming/Exercises/Static_arrays/Pages
Keine Kommentare:
Kommentar veröffentlichen