Write a C program not c that prints user entered integers o

Write a C program ( not c++) that prints user entered integers on a single line. They choose the size of the array. The program must also print the second half of the array in reverse AND find the average of the second half of integers

In main you must prompt the user to enter length of array. And call both functions

Must use two functions:
1. Void inputvalues( Int arrayLen, int arrayToFill[]);

2. Void printArray( int length, int toPrint[]); use loops in this function




Write a C program ( not c++) that prints user entered integers on a single line. They choose the size of the array. The program must also print the second half of the array in reverse AND find the average of the second half of integers

In main you must prompt the user to enter length of array. And call both functions

Must use two functions:
1. Void inputvalues( Int arrayLen, int arrayToFill[]);

2. Void printArray( int length, int toPrint[]); use loops in this function





In main you must prompt the user to enter length of array. And call both functions

Must use two functions:
1. Void inputvalues( Int arrayLen, int arrayToFill[]);

2. Void printArray( int length, int toPrint[]); use loops in this function





Must use two functions:
1. Void inputvalues( Int arrayLen, int arrayToFill[]);

2. Void printArray( int length, int toPrint[]); use loops in this function




Solution

#include <iostream>

using namespace std;

int main()

{

int size;

double sum = 0;

double avg;

cout << \"How many numbers? \";

cin >> size;

// dynamically allocate array

int * array = new int[size];

// first loop - get the data

for (int count=0; count<size; count++)

{

cout << \"Enter Number: \";

cin >> array[count];

}

// second loop - accumulate the total

for (int count=0; count<size; count++)

sum += array[count];

cout << \"The sum is \" << sum << endl;

avg = sum / size;

cout << \"The average is \" << avg << endl;

// de-allocate the array

delete [] array;

return 0;

}

 Write a C program ( not c++) that prints user entered integers on a single line. They choose the size of the array. The program must also print the second half
 Write a C program ( not c++) that prints user entered integers on a single line. They choose the size of the array. The program must also print the second half

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site