Wednesday, 8 April 2015

C Program to print the following Pattern.

A
B    B
C    C    C
D    D    D    D

 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

#include<stdio.h>
#include<conio.h>
main()
{
                char c='A';
                int i,n,j;
                clrscr();
                printf("Enter number of rows :\n");
                scanf("%d",&n);
                for(i=0;i<n;i++)
                {
                                for(j=0;j<=i;j++)
                                {
                                                printf("%c\t",c);
                                }
                                c++;
                                printf("\n");
                }
}

No comments:

Post a Comment