Uva 488 Triangle Wave

#include<stdio.h>
int main()
{
	int t,i,j,k;
	scanf("%d",&t);
	while(t--)
	{
		int amplitude;
		int frequency;
		scanf("%d%d",&litude,&frequency);
		for(i=0; i<frequency; i++)
		{
			for(j=1; j<=amplitude; j++)
			{
				for(k=1; k<=j; k++)
					printf("%d",j);
				printf("\n");
			}
			for(j=amplitude-1; j>=1; j--)
			{
				for(k=1; k<=j; k++)
					printf("%d",j);
				printf("\n");
			}
			if(i!=frequency-1)
				printf("\n");
		}
		if(t!=0)
			printf("\n");
	}
	return 0;
}

你可能感兴趣的:(Uva 488 Triangle Wave)