All number patterns using C programming Language

All numbers patterns using C programming Language


techstudy.org

Kindle Paperwhite High Resolution Display Tablet | Rs. 9999

Number pattern : 1

1
12
123
1234
12345

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#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;
}

Number pattern : 2

5
45
345
2345
12345

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

Number pattern : 3

12345
1234
123
12
1

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

Number pattern : 4

12345
2345
345
45
5

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

Number pattern : 5

54321
4321
321
21
1

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

Number pattern : 6

54321
5432
543
54
5

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

     


Number pattern : 7

1
21
321
4321
54321

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

Number pattern : 8

5
54
543
5432
54321

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


Number pattern : 9

1
22
333
4444
55555

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#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;
}

Number pattern : 10

5
44
333
2222
11111

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




Number pattern : 11

1234567
12345
123
1

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

Number pattern : 12

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


Number pattern : 13

1234567
12345
123
1

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

Number pattern : 14

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


Number pattern : 15

55555
45555
34555
23455
12345
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
int main()
{
    int i, j, k;
    for(i=5; i>=1; i--)
    {
        k = i;
        for(j=1; j<=5; j++)
        {
            if(k <= 5)
            {
                printf("%d", k);
            }
            else
            {
                printf("5");
            }
            k++;
        }
        printf("\n");
    }
    return 0;
}

Number pattern : 16

1
01
101
0101

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



Number pattern : 17

1
24
135
2468
13579

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

Number pattern : 18

13579
3579
579
79
9

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

return 0;
}

Number pattern : 19

0        0
01      01
010    010
0101  0101
0101001010
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int i,j,k,l=8,m,n,o,p;
  6. for(i=0; i<=4; i++)
  7. {
  8. for(j=0; j<=i; j++)
  9. {
  10. if(j%2==0)
  11. printf("0");
  12. else
  13. printf("1");
  14. }
  15. for(k=1; k<=l; k++)
  16. {
  17. printf(" ");
  18. }
  19. l = l-2;
  20. for(m=0; m<=i; m++)
  21. {
  22. if(m%2==0)
  23. printf("0");
  24. else
  25. printf("1");
  26. }
  27.  
  28. printf("\n");
  29. }
  30. return 0;
  31. }
  32.  

Number pattern : 20

     0
    01
   010
  0101
 01010
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int i,j,k;
  6.  
  7. for(i=0 ; i<=4 ; i++)
  8. {
  9. for(j=4 ; j>i ; j--)
  10. printf(" ");
  11.  
  12. for(k=0 ; k<=i; k++)
  13. {
  14. if(k%2==0)
  15. printf("0");
  16. else
  17. printf("1");
  18. }
  19. printf("\n");
  20. }
  21.  
  22. return 0;
  23. }
  24.  




Related Topics



Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer and technology lovers. http://www.techstudy.org/.