Using an array write a program that asks for 10 numbers of type int stores it in an array and traversing each item counting the number of items that are greater than 5. Display the result.
1
Expert's answer
2014-10-08T10:39:38-0400
Code #include <iostream>
usingnamespace std;
int main(){ int numbers[10];
// Input cout << "Enter ten integernumbers: "; for(int i = 0; i < 10; i++){ cin >> numbers[i]; }
// Output int counter = 0; for(int i = 0; i < 10; i++){ if(numbers[i]> 5){ counter++; } }
Comments
Leave a comment