标签:循环
vim peri.c
#include <stdio.h>
int main(){
int season = 0;
printf("请输入阶段:");
scanf("%d",&peri);
switch(peri % 4){
case 0:
printf("第一阶段\n");
break;
case 1:
printf("第二阶段\n");
break;
case 2:
printf("第三阶段\n");
break;
case 3:
printf("第四阶段\n");
break;
default:
printf("第五阶段\n");
break;
}
}
chmod +x peri
gcc peri.c
./out
vim num.c
#include <stdio.h>
int main(){
int num1 = 0, num2 = 0;
for (num1 = 6;num1 >= 1;num1--){
for(num2 = num1;num2 >= 1;num2--){
printf("%d",num2);
}
printf("\n");
}
return 0;
}
本文出自 “Linux运维之道” 博客,谢绝转载!
标签:循环
原文地址:http://sigelinux.blog.51cto.com/8875874/1766043