Number Digits Pattern Series Programs in C

Number Digits Pattern Series Programs in C

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

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

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

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

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

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

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

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

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

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
#include<stdio.h>
int main()
{
    int i,j,k=1;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {
            printf("%d\t",k);
            k++;
        }
        printf("\n");
    }
    return 0;
 }

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

1
3 5
7 9 11
13 15 17 19
21 23 25 27 29
#include<stdio.h>
int main()
{
    int i,j,k=1;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {

            printf("%d\t",k);
            k=k+2;
        }
        printf("\n");
    }
    return 0;
 }

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

2
4 6
8 10 12
14 16 18 20
22 24 26 28 30
#include<stdio.h>
int main()
{
    int i,j,k=2;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {

            printf("%d\t",k);
            k=k+2;
        }
        printf("\n");
    }
    return 0;
 }

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

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

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

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

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

2
2 4
2 4 6
2 4 6 8
2 4 6 8 10
#include<stdio.h>
int main()
{
    int i,j,k;
    for(i=1;i<=5;i++)
    {
        k=2;
        for(j=1;j<=i;j++)
        {
            printf("%d\t",k);
            k=k+2;
        }
        printf("\n");
    }
    return 0;
 }

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

1
1 3
1 3 5
1 3 5 7
1 3 5 7 9
#include<stdio.h>
int main()
{
    int i,j,k;
    for(i=1;i<=5;i++)
    {
        k=1;
        for(j=1;j<=i;j++)
        {
            printf("%d\t",k);
            k=k+2;
        }
        printf("\n");
    }
    return 0;
 }

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

2
4 4
6 6 6
8 8 8 8
10 10 10 10 10
#include<stdio.h>
int main()
{
    int i,j,k=2;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {
            printf("%d\t",k);
        }
        k=k+2;
        printf("\n");
    }
    return 0;
 }

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

1
3 3
5 5 5
7 7 7 7
9 9 9 9 9
#include<stdio.h>
int main()
{
    int i,j,k=1;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {
            printf("%d\t",k);
        }
        k=k+2;
        printf("\n");
    }
    return 0;
 }

Published by

admin

I am a computer teacher, programmer and web developer