Exercise 4-10 Finding the minimum value (20 points)
This question requires writing a program to find the minimum value in a given series of integers.
Input format:
Enter a positive integer n in one line, followed by n integers, separated by spaces.
Output format:
output the minimum value of n integers in a line in the format of "min = minimum value".
Input sample:
4 -2 -123 100 0
Output sample:
min = -123
#include<stdio.h>
int main()
{
int i,n,min=100000;
int a[1000];
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<=n;i++)
{
if(a[i]<min)
min=a[i];
}
printf("min = %d",min);
}