C examples for Statement:for
Generate and print on-screen the following geometrical pattern using the nested loops.
pattern as follows 1 212 32123 4321234 543212345
#include <stdio.h> int main()/* ww w . j a v a2s .c o m*/ { int count = 8; for (int i = 1; i <= count; i++){ for (int j = count; j > i; j--){ printf(" "); } for (int k = i; k >= 1; k--) { printf("%d", k); } for (int m = 2; m <= i; m++) { printf("%d", m); } printf("\n"); } return 0; }