Starting from:
$35

$29

Lab09 Task Solution

Write a C program that performs the task described below. Name your c le as nameSurnameId.c [ex: basakKarakas1850044026.c]

Upload your    le to your section’s submission page on moodle.

    • Task

In statistics, the mode is the most frequently observed value in a data set.

In this task, you must compute the mode of a set of 100 elements.

Firstly, build the set with integers between 1 and 10 that will be randomly generated. Then de ne and use the following functions to calculate the mode. Show how many of each element the set contains before showing its mode. The screenshot should look like the one below:













Functions:

    • int  nd mode(int n, int arr[ ]);

This function  nds the mode of an array with n elements.

    • int  nd number of x(int x, int n, int arr[ ]);

This function  nds how many x are in an array with n elements.

    • int  nd max(int arr[ ]);

This function  nds the maximum element of an array with 10 elements.


Good luck :)


1

More products