Respuesta :
Answer:
The program to this question can be given as:
Program:
#include <iostream> //header file
using namespace std;
void reverse(int a[], int starting_point, int ending_point) //revers function
{
while (starting_point < ending_point) //loop
{
int temp = a[starting_point];
a[starting_point] = a[ending_point];
a[ending_point] = temp;
starting_point++;
ending_point--;
}
}
void print_Array(int a[]) // print_Array function
{
for (int i = 0; i <=9; i++) //loop for print values
{
cout << a[i] << "\t";
}
}
int main() //main function
{
int a[] = {5,2,4,6,8,10,1,7,3,9}; //array
int n=10;
cout <<"Array is:"<< endl; //message
print_Array(a); //calling function
reverse(a, 0, n-1);
cout <<"Reversed array is:"<< endl; //message
print_Array(a);
return 0;
}
Output:
Array is:
5 2 4 6 8 10 1 7 3 9
Reversed array is:
9 3 7 1 10 8 6 4 2 5
Explanation:
In the above c++ program firstly we define the header file then we declare two functions that are reveres and print_Array. In the reveres function, we pass three parameters that are a[],starting_point,ending_point. in this function we define loop for the reverse array. In this loop, we declare a temp variable that holds the reverse values and passes to array. Then we declare another function print_Array in this function we print array value. At the last we declare the main function in this function we declare an array and initialize array and the call functions.
Answer:
integers = []
while True:
number = int(input("Enter integers (Enter negative number to end) "))
if number < 0:
break
integers.append(number)
print ("The smallest integer in the list is : ", min(integers))
print("The largest integer in the list is : ", max(integers))
Explanation: