In this problem you are to generate a triangular wave form according to a specified pair of amplency and frequency.
Input and Output
The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. this line is followed by a blank line, and there is also a blank line between two consecutive inputs.
Each input set will contain two integers, each on a separate line. The first integer is the amplency; the second integer is the frequency.
For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.
For the output of your program, you will be printing wave forms each separated by a blank line. the total number of wave forms equals the frequency, and the horizontal ''height' of each wave equals the Amplications. the amplater will never be greater than nine.
The waveform itself shoshould be filled with integers on each line which indicate the ''height' of that line.
Note:There is a blank line after each separate waveform,ExcludingThe last one.
Sample Input
132
Sample output
122333221122333221
I haven't reviewed my questions for a long time. Today, I have to wait for a while. The output format is a little strange ~~
#include <stdio.h>void printTriangel(int m){int i, j;for(i = 1; i < m; ++i){for(j = 1; j <= i; ++j)printf("%d", i);printf("\n");}while(i >= 1){for(j = 1; j <= i; ++j)printf("%d", i);printf("\n");--i;}}int main(){int t, m, n;scanf("%d", &t);while(t--){scanf("%d%d", &m, &n);while(n--){printTriangel(m);if(t || n) putchar('\n');}}return 0;}