Current location - Trademark Inquiry Complete Network - Futures platform - C language inputs a positive integer n, then inputs n integers and outputs the minimum value. Two programs are written below. Please help me analyze where they are wrong.
C language inputs a positive integer n, then inputs n integers and outputs the minimum value. Two programs are written below. Please help me analyze where they are wrong.
The first one cannot dynamically define the array size, that is, it cannot

int n;

Printf ("Enter n:");

scanf("%d ",& ampn);

int a[n];

And put min=a[0] outside the for statement.

In addition, neither of these scanf statements has the address character &;

On the second basis, the amendment is as follows

# include & ltstdio.h & gt

int main()

{

int n,I,a[ 100],min

Printf ("Enter n:");

scanf("%d ",& ampn);

Printf ("Input number:");

for(I = 0; I & ltn;; i++) scanf("%d ",& ampa[I]);

min = a[0];

for(I = 0; I & ltn;; i++)

{

if(a[I]& lt; min)min = a[I];

}

printf("min=%d\n ",min);

Returns 0;

}