C Program To Find Minimum Number In Array


♣ Try it Out ::
#include<stdio.h>
#include<conio.h>

main()
{
    int Array[100], MinNum, Size, pos = 1, i;

    printf("How many numbers you wish to input in array: ");
    scanf("%d", &Size);

    printf("Enter %d integers: ", Size);
    for(i=0; i<Size; i++)
        scanf("%d", &Array[i]);

    MinNum = Array[0];

    for(i=1; i<Size; i++)
    {
        if(Array[i] < MinNum)
        {
            MinNum = Array[i];
            pos = i + 1;
        }
    }

    printf("\nMinimum number is %d and it's position is %d.\n", MinNum, pos);

    getch();
    return(0);
}

♣ Output ::
How many numbers you wish to input in array: 5
Enter 5 integers: 122 10 55 36 21

Minimum number is 10 and it's position is 2.

♣ Downloads ::

Comments

Popular posts from this blog

C++ :: Topological Sort Algorithm (using DFS)

How to Hack Facebook Account

C++ :: Strongly Connected Components Algorithm (SCC)