Displaying ./code/cs256su21code/jun07/loop3.c/* using nested loops this is the output 0 1 0 2 1 0 3 2 1 0 4 3 2 1 0 5 4 3 2 1 0 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 10 9 8 7 6 5 4 3 2 1 0 */ #include <stdio.h> int main() { int i, j; for(i = 0; i <= 10; i++){ for(j = i; j >= 0; j--){ //this inner loop runs i number of times for every 1 time the outer loop runs printf("%d ",j); } printf("\n"); } return 0; } |