0% found this document useful (0 votes)
15 views2 pages

C Program Star Patterns Guide

The document contains four different C programs that generate star patterns. The first pattern displays an increasing number of stars, the second shows a decreasing number, the third aligns stars to the right in an increasing pattern, and the fourth aligns stars to the right in a decreasing pattern. Each program utilizes nested loops to achieve the desired output.

Uploaded by

Anik Dutta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

C Program Star Patterns Guide

The document contains four different C programs that generate star patterns. The first pattern displays an increasing number of stars, the second shows a decreasing number, the third aligns stars to the right in an increasing pattern, and the fourth aligns stars to the right in a decreasing pattern. Each program utilizes nested loops to achieve the desired output.

Uploaded by

Anik Dutta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Star Pattern - 1

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

#include <stdio.h>

int main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}

Star Pattern - 2
*****
****
***
**
*

#include <stdio.h>

int main()
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}

Star Pattern - 3
*
**
***
****
*****

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

Star Pattern - 4
*****
****
***
**
*

#include <stdio.h>

int main()
{
int i, j, k;
for(i=5;i>=1;i--)
{
for(j=5;j>i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("*");
}
printf("\n");
}

You might also like