#include<stdio.h>
void printN1(int N);
void printN2(int N);
int main(){
int shi = 10;
int bai = 100;
int qian = 1000;
int yiwan = 10000;
int shiwan = 100000;
// printN1(qian);//0.1008s
// printN1(yiwan);//0.7425s
// printN1(shiwan);//无
// printN2(qian);//0.09672s
// printN2(yiwan);//0.5881s
printN2(shiwan);//65.27s
return 0;
}
void printN1(int N){
if(N){
printN1(N-1);
printf("%d\n",N);
}
return ;
}
void printN2(int N){
int i;
for(i = 1;i<=N;i++){
printf("%d\n",i);
}
return ;
}
依次打印从1到N的程序
于 2024-07-10 16:26:12 首次发布