Pattern #12

Example#1: C program to generate pattern 12

#include<stdio.h>
int main()
{
	int n,i,j,k;
	printf("Enter number of rows:");
	scanf("%d",&n);
	for(i=n;i>=1;i--)
	{
		for(j=i;j>=1;j--)
		{
			printf(" ");
		}
	    for(k=i;k<=n;k++)
	    {
	    	printf("%d",k);
		}
		printf("\n");
	}
	return 0;
}

Output:

Facebook Comments

Back to Top