输出结果:odd
#include<stdio.h>
int main() {
int num,r;
num=17;
r=num%2;
if(r==0)printf("even");
else printf("odd");
}
输出结果:7 6 5 4 3 2 1
#include<stdio.h>
#define N 7
int main() {
int i,j,temp,a[N]= {1,2,3,4,5,6,7};
for(i=0; i<N/2; i++) {
j=N-1-i;
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
for(i=0; i<N; i++)
printf("%d ",a[i]);
}
输出结果:0,10#10,10#
#include<stdio.h>
int p(int x,int *y) {
*y=x++;
}
int main() {
int x=0,y=0;
p(10,&y);
printf("%d,%d#",x,y);
p(y,&x);
printf("%d,%d#",x,y);
}
输出结果:22
#include<stdio.h>
int hzct(int n) {
if(n==4) return 1;
else return 2*(hzct(n+1)+1);
}
int main() {
printf("%d\n",hzct(1));
}
输出结果:
1!=1
2!=2
3!=6
4!=24
5!=120
#include<stdio.h>
int main() {
int fac(int n);
int i;
for(i=1; i<=5; i++)
printf("%d!=%d\n",i,fac(i));
}
int fac(int n) {
static int f=1;
f=f*n;
return(f);
}
小剧场:空气凌冽,月光皎洁。The air is cold and the moon is bright.