In: Computer Science
how to make a program in c++ that has an array that holds up to 25 digits.Then have a user input 25 values and check to see if each input value is between 10 and 50?
#include<iostream>
using namespace std;
int main(){
int numbers[25];
cout<<"Enter the 25 numbers";
for(int i=0;i<25;i++)
cin>>numbers[i];
cout<<"\nChecking whether the entered numbers
are between 10 and 50 : \n";
for(int i=0;i<25;i++){
if(numbers[i] > 10 &&
numbers[i]<50)
cout<<"The
number "<<i+1<<" is "<<numbers[i]<<" which
is between 10 and 50\n";
else
cout<<"The
number "<<i+1<<" is "<<numbers[i]<<" which
is not between 10 and 50\n";
}
return 0;
}
====================================
======================
output
======================
Enter the 25 numbers 3 9 10 11 49 50 51 34 23 45 76
43 12 97 54 33 -8 0 100 90 -67 -16 78 53 78
Checking whether the entered numbers are between 10 and 50 :
The number 1 is 3 which is not between 10 and 50
The number 2 is 9 which is not between 10 and 50
The number 3 is 10 which is not between 10 and 50
The number 4 is 11 which is between 10 and 50
The number 5 is 49 which is between 10 and 50
The number 6 is 50 which is not between 10 and 50
The number 7 is 51 which is not between 10 and 50
The number 8 is 34 which is between 10 and 50
The number 9 is 23 which is between 10 and 50
The number 10 is 45 which is between 10 and 50
The number 11 is 76 which is not between 10 and 50
The number 12 is 43 which is between 10 and 50
The number 13 is 12 which is between 10 and 50
The number 14 is 97 which is not between 10 and 50
The number 15 is 54 which is not between 10 and 50
The number 16 is 33 which is between 10 and 50
The number 17 is -8 which is not between 10 and 50
The number 18 is 0 which is not between 10 and 50
The number 19 is 100 which is not between 10 and 50
The number 20 is 90 which is not between 10 and 50
The number 21 is -67 which is not between 10 and 50
The number 22 is -16 which is not between 10 and 50
The number 23 is 78 which is not between 10 and 50
The number 24 is 53 which is not between 10 and 50
The number 25 is 78 which is not between 10 and 50