3.(20分) 要求:从键盘输入10个整数存入一个数组中,用函数编程将其中的最大数与最小数位置互换,然后输出互换后的数组。函数原型:void MaxMinExchang(int a[], int n);
输入提示信息:“Input 10 numbers:”
输入格式:"%d"
输出提示信息:“Exchang results:”
输出格式:"%4d"
程序运行结果示例:
Input 10 numbers:0 2 7 4 9 11 5 47 6 97↙
Exchang results: 97 2 7 4 9 11 5 47 6 0
#include<stdio.h>
int fun(int n);
int main()
{
int i;
for(i=100;i<=1000;i++)
if(fun(i)==i)
printf("%d\n",i);
return 0;
}
int fun(int n)
{
int i,sum=0;
for(i=1;i<n;i++)
if(n%i==0){
sum+=i;
}
return sum;
}```