标签:number include efi scan The scanf fine ++ 最大数和最小数
最大数
#include <stdio.h>
#define MAX 10
int main() {
int n, a[MAX];
printf("Input the number of figure(<10):\n");
scanf("%d",&n);
for (int i = 0; i < n; i++)
{
scanf("%d",&a[i]);
}
int temp;
temp = a[0];
for (int j = 1; j < n; j++)
{
if (temp < a[j])
temp = a[j];
}
printf("the max number is:%d\n",temp);
return 0;
}
最小数
#include <stdio.h>
#define MAX 10
int main() {
int n, a[MAX];
printf("Input the number of figure(<10):\n");
scanf("%d",&n);
for (int i = 0; i < n; i++)
{
scanf("%d",&a[i]);
}
int temp;
temp = a[0];
for (int j = 1; j < n; j++)
{
if (temp > a[j])
temp = a[j];
}
printf("the mix number is:%d\n",temp);
return 0;
}
标签:number include efi scan The scanf fine ++ 最大数和最小数
原文地址:https://www.cnblogs.com/AdvacneQxj/p/12826363.html