#include <stdio.h>
void main()
{
int array[100], min, size, i, location = 1;
printf("Enter the number of elements in array\n");
scanf("%d",&size);
printf("enter the elements:);
for ( i = 0 ; i< size ; i++ )
scanf("%d", &array[i]);
min = array[0];
for ( i = 1 ; i < size ; i++ )
{
if ( array[i] < min )
{
min= array[i];
location = i+1;
}
}
printf("Minimum element is present at location %d and it's value is %d.\n", location, minimum);
}
void main()
{
int array[100], min, size, i, location = 1;
printf("Enter the number of elements in array\n");
scanf("%d",&size);
printf("enter the elements:);
for ( i = 0 ; i< size ; i++ )
scanf("%d", &array[i]);
min = array[0];
for ( i = 1 ; i < size ; i++ )
{
if ( array[i] < min )
{
min= array[i];
location = i+1;
}
}
printf("Minimum element is present at location %d and it's value is %d.\n", location, minimum);
}
No comments :
Post a Comment