13. 数组
#include"stdio.h"
main()
{
int j,k;
static int x[4][4],y[4][4];
for(j=0;j<4;j++)
for(k=j;k<4;k++)
x[j][k]=j+k;
for(j=0;j<4;j++)
for(k=j;k<4;k++)
y[k][j]=x[j][k];
for(j=0;j<4;j++)
for(k=0;k<4;k++)
printf("%d,",y[j][k]);
}
运行结果为:
0,0,0,0,1,2,0,0,2,3,4,0,3,4,5,6
函数
1.
#include <stdio.h>
int Sub(int a, int b)
{
return (a- b);
}
main()
{
int x, y, result = 0;
scanf("%d,%d", &x,&y );
result = Sub(x,y ) ;
printf("result = %d\n",result);
}
当从键盘输入:6,3运行结果为:
result =3
2.
#include <stdio.h>
int min( int x, int y )
{
int m;
if ( x> y )
m = x;
else
m = y;
return(m);
}
main()
{
int a=3,b=5,abmin;
abmin = min(a,b);
printf("min is %d", abmin);
}
运行结果为:
min is 5