Print Star Patter in C
Print Star Pattern in C It is very simple just we need concept of new line and for loop.Print Star Patter
*
***
*****
*******
*********
Example to Print Star Pat
#include <stdio.h>
#include <conio.h>
void main()
{
int i, j, n;
printf("Enter value of n : ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
for(j=i; j<n; j++)
{
printf(" ");
}
for(j=1; j<=(2*i-1); j++)
{
printf("*");
}
printf("\n");
}
getch();
}
No comments :
Post a Comment