首页 > 其他 > 详细

最大数和最小数

时间:2020-05-04 14:25:44      阅读:35      评论:0      收藏: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 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;
}

最大数和最小数

原文:https://www.cnblogs.com/AdvacneQxj/p/12826363.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!