how to find the largest number or smallest number in C language

array of number : 17 87 94 78 88 60 93 29 68 51

code to find the greatest number

#include<stdio.h>

int main()
{
    int array[11]={17,87,94,78,88,60,93,29,68,51};
    int a,max;
    max=0;//set max to 0 or -99999 so we can search the greatest number
    for(a=0;a<11;a++)//why a<11 because I have an array that can load up to 10 numbers
    {
        if(array[a]>=max)//if array[a] is greater than max then we replace max with array[a]
        {
            max=array[a];
        }
    }
    printf("The Greatest number in that array is %d",max);
    return 0;
}

that all from me 
thank you

Comments