Friday, June 19, 2015

pattern-character

int main()
{
    int i,rows,n;
    char j;
    printf("Enter the number of rows: ");
    scanf("%d",&rows);
    printf("Enter how much number or char you will print: ");
    scanf("%d",&n);
    for(i=1;i<=rows;i++)
    {
        for(j=65;j<=n-1;j++)
        {
           printf("%c ",j);
        }
    printf("\n");
    n--;
    }
    return 0;
}
otuput:


 A B C D E F G H I J
A B C D E F G H I
A B C D E F G H
A B C D E F G
A B C D E F
A B C D E
A B C D
A B C
A B
A




No comments:

Post a Comment