C language: print a pattern on the screen
Output case on the screen: **************************************** **************************************** * ***** solution: program: # include <stdio. h> int main () {int I, j, k, line; printf ("Enter the number of printed rows:"); scanf ("% d", & line ); for (I = 0; I <= (line-1)/2; I ++) {for (j = 0; j <= (line-3) /2-I; j ++) {printf ("") ;}for (k = 0; k <= 2 * I; k ++) {printf ("*") ;}printf ("\ n") ;}for (I = 0; I <= (line-3)/2; I ++) {for (j = 0; j <= I; j ++) {printf ("") ;}for (k = 0; k <= line-3-2 * I; k ++) {printf ("*");} printf ("\ n");} return 0;} result 1: enter the number of printed rows: 13 *************************************** **************************************** * ***** press any key to continue... result 2: Enter the number of printed rows: 17 *************************************** **************************************** **************************************** * ************************* press any key to continue...