C语言基础:for循环语句使用范例演示
#include <stdio.h>
int main ()
{
int counter;
for (counter = -100; counter <= 100; counter += 5)
printf("%d ", counter);
printf("\nStarting second loop\n");
for (counter = 100; counter >= -100; counter -= 25)
printf("%d ", counter);
return 1;
}
gcc编译运行结果
-100 -95 -90 -85 -80 -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 Starting second loop 100 75 50 25 0 -25 -50 -75 -100
