Xiaoming was punished for being mischievous in class and causing the teacher to be a bit angry. The teacher punished him to copy his name 100 times.
To prevent Xiaoming from slacking off, the teacher required that each name be numbered, and arranged in a “10×10 square matrix” for clarity.
Please help Xiaoming using C language.
#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>
int main(void) { const char* name = "小明"; for (int i = 1; i <= 100; ++i) { printf("%d.%s\t", i, name); // \t is a tab character for better alignment
// Change line after every 10 outputs if (i % 10 == 0) { printf("\n"); } }
/* Prompt user to press enter to exit */ printf("Completed 100 times. Press enter to exit...\n"); getchar(); return 0;}
The result of Xiaoming copying his name:


Xiaoming easily completed the task and promised not to be mischievous in the future. The teacher was very satisfied, gave a slight reprimand, and praised Xiaoming’s clever method, which not only saved time and effort but also conserved paper and ink.