Character Star Asterisk Pattern Series Programs in C

Character Star Asterisk Pattern Series Programs in C

1 Write a program to generate/print following pattern/series:

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

2 Write a program to generate/print following pattern/series:

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

3 Write a program to generate/print following pattern/series:

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

4 Write a program to generate/print following pattern/series:

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

5 Write a program to generate/print following pattern/series:

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

Published by

admin

I am a computer teacher, programmer and web developer