Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Write a program with a pointer, input 10 integers from the keyboard and store them in the array. It is required to exchange 1 input number for the largest number of 10.
Write a program with a pointer, input 10 integers from the keyboard and store them in the array. It is required to exchange 1 input number for the largest number of 10.
# include & ltstdio.h & gt

int main()

{int a[ 10],*p,*max,*min,t;

for(p = a; p & lta+ 10; p++)

scanf("%d ",p);

for(max = min = p = a; p & lta+ 10; p++)

if(* max & lt; * p)max = p;

else if(* min & gt; * p)min = p;

t = * a; * a = * max* max = t;

t = *(a+9); *(a+9)= * min; * min = t;

for(p = a; p & lta+ 10; p++)

printf("%d ",* p);

Returns 0;

}