# include & ltstdio.h & gt
void swc(int *x,int * y){ int t;t = * y;* y = * x;* x = t;}
主()
{
int x,y,z;
scanf("%d,%d,%d ",& ampx & amp;y & amp;z);
if(x & gt;y)SWC(& amp;x & amp;y);
if(x & gt;z)SWC(& amp;x & amp;z);
如果(y & gtz)SWC(& amp;y & amp;z);
printf("\n%d\n%d\n%d ",x,y,z);
返回0;
}
2
# include & ltstdio.h & gt
# include & ltstdlib.h & gt
# include & lttime.h & gt
#定義最大值10
主()
{
無符號int num[MAX],MAX,min,c,t;
srand(time(0));
for(t = 0;t & ltMAX++ t)num[t]= rand()% 71+30;
max = min = num[0];
c = 0;
for(t = 0;t & ltMAX++t)
{
if(max & lt;num[t])max = num[t];
else if(min & gt;num[t])min = num[t];
c+= num[t];
printf("%5d ",num[t]);
}
printf("\nmax=%d,min=%d,average=%d,sum=%d ",max,min,c/MAX,c);
返回0;
}
三
# include & ltstdio.h & gt
主()
{
浮點數s=1.0,t = 1.0;
int c=2,p = 2;
while(t & gt;1e-4)
{
t = 1.0/(float)c;
s+= t;
c+= p;
++ p;
}
printf("%f ",s);
返回0;
}