Page 19 of 19

Re: 488 - Triangle Wave

Posted: Sat Aug 29, 2015 1:02 pm
by prokawsar
Whats WRONG with this ? Getting WA

Code: Select all

/* Date: 29.08.15
Problem: Triangle Wave
*/
#include <stdio.h>
#include <string.h>

int main()
{

	int i, j, f, a;
	int t, x;

	scanf("%d", &t);
	while(t--){
		scanf("%d %d", &a, &f);

		for(x=1; x<=f; x++){
			for(i=1; i<=a; i++){
				for(j=0; j<i; j++){
					printf("%d", i);
				} printf("\n");
			}
			for(i=a-1; i>0; i--){
				for(j=0; j<i; j++){
					printf("%d", i);
				} printf("\n");
			}
			printf("\n");
		}
	}
	return 0;
}