UVa 488 - Triangle Wave

#include<stdio.h>
int main()
{
    int t,a,f;
    int i,j,k,l;
    scanf("%d",&t);
    for(i=1; i<=t; i++)
    {
        scanf("%d",&a);
        scanf("%d",&f);
        for(l=1; l<=f; l++)
        {
            for(j=1; j<=a; j++)
            {
                for(k=1; k<=j; k++)
                    printf("%d",j);
                printf("\n");
            }
            for(j=a-1; j>=1; j--)
            {
                for(k=1; k<=j; k++)
                    printf("%d",j);
                printf("\n");
            }
            if(l!=f)
                printf("\n");
        }
        if(i!=t)
            printf("\n");
    }
    return 0;
}
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 মন্তব্য(গুলি):

একটি মন্তব্য পোস্ট করুন