Header Ads

C program for Pascal triangle using square of number

***************************Program********************************

#include<stdio.h>
#include<conio.h>
main()
{
	int r,c,k,m;
	printf("Enter the number of lines : ");
	scanf("%d",&m);
	for(r=1;r<=m;r++)
    {
        for(c=1;c<=m-r;c++)
        {
            printf(" ");
        }
        for(k=1;k<=r;k++)
        {
            printf("%d ",k*k);
        }
        printf("\n");
    }
    getch();
	return 0;
}


***************************Output*********************************


No comments