Home

Published

- 1 min read

star pattern in c

img of star pattern in c

The solution for this is noted below

star pattern in c

Solution

   #include <stdio.h>
#include <stdlib.h>                                      INPUT  : 5
                                                         OUTPUT :
int main(void)                                                   *
{                                                               * *
	int n,k,i,j;                                               * * *
	setbuf(stdout,NULL);                                      * * * *
	printf("Enter the limit of the number = ");              * * * * *
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		printf("\n");
		for(j=1;j<=n-i;j++)
		{
			printf(" ");
		}
		for(k=1;k<=i;k++)
			printf("* ");
	}
	return EXIT_SUCCESS;
}

Try other methods by searching on the site. That is if this doesn’t work