I have an array of 20 elements with numbers between 1 and 8. I need a for loop that will give me the number of elements greater than 1???
jjmy95
0
Newbie Poster
Recommended Answers
Jump to PostCreate another variable to store the number of 1's. You go through all elements of the array and each time it equals 1 you increment that variable by 1.
You could think of that by yourself ain't that hard.
Jump to PostWhat have you tried so far?
All 5 Replies
Jiwe
0
Junior Poster in Training
jjmy95
0
Newbie Poster
jjmy95
0
Newbie Poster
jonsca
1,059
Quantitative Phrenologist
Team Colleague
Featured Poster
Grn Xtrm
84
Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.