C语言基础:for从大到小循环语句范例的代码
下面的代码内容是关于C语言基础:for从大到小循环语句范例的代码,应该能对各位有些用处。
#include <stdio.h>
int main ()
{
int counter;
for (counter = 5; counter >= 1; counter--)
printf("%d ", counter);
printf("nStarting second loopn");
for (counter = 10; counter >= 1; counter--)
printf("%d ", counter);
printf("nStarting third loopn");
for (counter = 0; counter >= 1; counter--)
printf("%d ", counter);
return 1;
}
gcc编译运行结果
5 4 3 2 1
Starting second loop
10 9 8 7 6 5 4 3 2 1
Starting third loop