Sunday, 8 May 2016

Print Star Pattern in C

Print Star Pattern in C

Hello friends today we write one of the most popular program; Print Star Pattern in C. To print star pattern you need for loop concept.

Print Star Pattern in C

Code:

#include<stdio.h>
#include<conio.h>
void main()
{
 int i, j;
 for(i=5;i>=1;i--)
  {
   for(j=1;j<=i;j++)
    {
     printf("*");
    }
    printf("\n");
    }
 getch();
}

Output

*****
****
***
**
*

No comments:

Post a Comment