Lab 5 This manual covers: i. One dimensional array ii. Sorting ...
Lab 5 This manual covers: i. One dimensional array ii. Sorting ...
Lab 5 This manual covers: i. One dimensional array ii. Sorting ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Lab</strong> 5<strong>This</strong> <strong>manual</strong> <strong>covers</strong>:i. <strong>One</strong> <strong>dimensional</strong> <strong>array</strong><strong>ii</strong>. <strong>Sorting</strong> algorithm<strong>ii</strong>i. 2 <strong>dimensional</strong> <strong>array</strong>Exercise 5.1 ------------------------------------------------------------------Write, compile, build and run the following program. The program shows a simple <strong>array</strong>by displaying the <strong>array</strong> number and its content.#include{}int main()int i;int <strong>array</strong>[10] = {1,12,9,4,4,34,23,8,2,7};for (i=0; i
void main(void){int <strong>array</strong>[10];printf("average = %.2f\n",avg_<strong>array</strong>(<strong>array</strong>));}double avg_<strong>array</strong>(int <strong>array</strong>[]){int i, total=0;double average;printf("Input data :\n");for (i=0; i
void input(int []);void sort(int []);void print(int []);void main (void){int marks[10];input(marks);sort(marks);print(marks);}void input(int marks[]){int i;for (i=0; i
for (i=0; i
Exercise 5.8Write and run the following program.#include #include#define SIZE 10int main(void){int n[SIZE]={19,3,15,7,11,9,13,5,17,1};int i,j;printf("%s%13s%17s\n","Element","Value","Histogram");for(i=0;i