當前位置:編程學習大全網 - 編程軟體 - 編程輸入三個數字x

編程輸入三個數字x

當輸入1時,三個數字用逗號隔開。

# 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;

}

  • 上一篇:迪慶北大青鳥遊戲編程培訓學費多少?
  • 下一篇:給媽媽發編程代碼的微信
  • copyright 2024編程學習大全網