Write a Program To Find Largest and Lowest Number in the List - Write a Program To Find Largest and Lowest Numbers in C Language

 Program To Find Largest and Lowest Number in the List

#include<stdio.h>

int main()

{

    int a[20], size, i, high, low;

    printf("\nEnter the size of the numbers list: ");

    scanf("%d", &size);

    printf("\n\nEnter the %d numbers of the list: \n\n", size);

    for(i = 0; i < size; i++)

    scanf("%d", &a[i]);

    high = a[0];

    for(i = 1; i < size; i++)

    {

        if(high < a[i])

        {

            high = a[i];

        }

    }
    printf("\n\nThe largest number of the list is = %d", high);

    low = a[0];

    for(i = 1; i < size; i++)

    {

        if(low>a[i])

        {

            low = a[i];

        }

    }

     printf("\n\nThe smallest number of the list is =  %d\n\n", low);

    return 0;

}

इस कोड को हमने CODEBLOCK पर बना कर run किया है

OUTPUT

Comments