1 输入时三个数间逗号分隔
#include
void swc(int *x,int *y){int t;t=*y;*y=*x;*x=t;}
main()
{
int x,y,z;
scanf("%d,%d,%d",&x,&y,&z);
if(x>y) swc(&x,&y);
if(x>z) swc(&x,&z);
if(y>z) swc(&y,&z);
printf("\n%d\n%d\n%d",x,y,z);
return 0;
}
2
#include
#include
#include
#define MAX 10
main()
{
unsigned int num[MAX],max,min,c,t;
srand(time(0));
for(t=0;t
c=0;
for(t=0;t
if(max
c+=num[t];
printf("%5d",num[t]);
}
printf("\nmax=%d,min=%d,average=%d,sum=%d",max,min,c/MAX,c);
return 0;
}
3
#include
main()
{
float s=1.0,t=1.0;
int c=2,p=2;
while(t>1e-4)
{
t=1.0/(float)c;
s+=t;
c+=p;
++p;
}
printf("%f",s);
return 0;
}
#include
int main()
{int x,y,z,t;
scanf("%d%d%d",&x,&y,&z);
if(x>y){t=x;x=y;y=t;}
if(x>z){t=x;x=z;z=t;}
if(y>z){t=y;y=z;z=t;}
printf("%d %d %d\n",x,y,z);
return 0;
}