Problem 1 33 points Write a progra m that reads a list of in
Problem 1 (33 points): Write a progra m that reads a list of integers from the keyboard and creates the following information a. Finds and prints the sum and the average of the integers b. Finds and prints the square root of each integer c. Prints a Boolean (true or false) if some of the integers are less than 20 d. Prints a Boolean (true or false) if some of the integers are between 10 and 90 The input data consists of a list of integers input one by one while each of the values is processed through the functions. No arrays!!!! Utilize pass by reference! The output should be formatted as shown below The number of integers is The sum of the integers is The average of the integers is The square root is At least one number was true or false>
Solution
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<\"\ enter n : \";
cin>>n;
int a[n];
cout<<\"\ enter \"<<n<<\" integers: \";
for(int i=0;i<10;i++)
{
cin>>a[i];
}
int sum=0;
boolean f1=false,f2=false;
for(int i=0;i<10;i++)
{
if(a[i]<20)f1=true;
if(a[i]>=10&&a[i]<=90)f2=true;
sum=sum+a[i];
}
double avg=sum/n;
cout<<\"sum : \"<<sum<<\"\\t average : \"<<avg;
cout<<\"\ some integers are less than 20 :\"<<f1;
cout<<\"\ some integers are between 10 and 90 : \"<<f2;
return 0;
}
