Software & Finance





Turbo C - Find Biggest of N Numbers





Here is a simple program explains the concept of an array and finds the biggest of given N numbers.


Source Code


#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

#include <bios.h>

#include <ctype.h>

 

#include MAX_NUMBERS 10

 

void main()

{

        int i, big, numbers[MAX_NUMBERS];

       

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

        {

            printf("Enter [%d] Number: ", i + 1);

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

        }

        big = numbers[0];

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

        {

            if(big < numbers[i])

                big = numbers[i];

        }

        printf("Biggest Number: %d\n", big);

}

Output


Enter 1 Number: 2

Enter 2 Number: 8

Enter 3 Number: 6

Enter 4 Number: 4

Enter 5 Number: 2

Enter 6 Number: 3

Enter 7 Number: 10

Enter 8 Number: 1

Enter 9 Number: 9

Enter 10 Number: 5

 

Biggest Number: 10