Computer Science, asked by vievekananda9885, 1 year ago

Write a program to find a maximum and minimum element in an array of 10 numbers php

Answers

Answered by Anonymous
1
#include<stdio.h>


int main ()


{


int i; int a[10] =


{



10, 55, 9, 4, 234, 20, 30, 40, 22, 34 };



int max = a[0]; int min = a[0]; for (i = 0; i < 10; i++)



{ if (a[i] > max) { max = a[i]; } else if (a[i] < min) { min = a[i]; }



}


printf



("Maximum element in an array : %d\n", max);



printf ("Minimum element in an array : %d\n",





min); return 0; }
Similar questions