#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int main()
{
//求是个数中最大值
/*int a[10] = {1,10,20,30,40,50,60,70,80,90};
int max = 0;
int i = 0;
for (i;i<sizeof(a) / sizeof(a[0]);i++)
{
if (a[i]>max)
{
max = a[i];
}
}
printf("%d \n",max);
system("pause");
return 0;*/
//将三个数按从大到小输出。
int a = 10;
int b = 20;
int c = 30;
int t = 0;
if (a<b)
{
t = a;
a = b;
b = t;
}
if (a<c)
{
t = a;
a = c;
c = t;
}
if (b<c)
{
t = b;
b = c;
c = t;
}
printf("%d %d %d\n", a, b, c);
system("pause");
}
C语言-将十个数按从大到小输出
最新推荐文章于 2024-04-30 12:08:31 发布