Purchase Solution

Pickup 10 Numbers and Store Array Using Function fillAr

Not what you're looking for?

Ask Custom Question

Using c-language programming (not C++):

Write a complete program to do the following specification:

1. Pickup 10 numbers and store it in an array using function fillArray.
2. Print the content of array with the message "Array not sorted" using printArray function.
3. Copy array a into array b using copyArray(a,b,10) function.
4. Sort array b in ascending order using sortArray(b,10) function.
5. Print array b with message "sorted array" using printArray
6. Pickup 10 numbers and store it in array c.
7. Find largest, smallest, and median values of array c and print them.
8. Print largest number of two arrays a,c and specify which array contains it.
9. Your program should ask for a number and print "YES" if the number is in array a, otherwise print "not found"

Purchase this Solution

Solution Summary

This Solution provides the code requested in the question.

Solution Preview

// 184948.c

#include <stdio.h>
#include <stdlib.h>

// Define fillArray function to create an array of 10 random integers
void fillArray(int array[]) {
int i;
for (i=0; i<10; i++) {
array[i] = rand();
}
}

// Define printArray to print out an array
void printArray(int array[], char *message) {
int i;
printf("%s: [", message);
for (i=0; i<10; i++) printf("%d ", array[i]);
printf("]n");
}

// Define copyArray to copy from one array to the other
void copyArray(int arrayA[], int arrayB[], int length) {
int i;
for (i=0; i<length; i++) arrayB[i] = arrayA[i];
}

// Define sortArray to sort an array in ascending order
void sortArray(int array[], int length) {
int i,j;
int temp;
for (i=0; i<length; i++) {
for (j=i; j<length; j++) {
if ...

Purchase this Solution


Free BrainMass Quizzes
Basic Networking Questions

This quiz consists of some basic networking questions.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.