Pattern 39: C Program to print the below number pattern 16 using for loops

Spread the love

Write a C Program to print below number pattern on the console:

Enter how many rows you want : 5
 1
 1 0
 1 0 1
 1 0 1 0
 1 0 1 0 1
Note: This program is one of the Series of Number pattern programs in C.

Program to print number pattern:

  1. /*
  2.    C Program to print number pattern on Console
  3.    WebSite: www.SillyCodes.com
  4. */
  5. #include<stdio.h>
  6. int main()
  7. {
  8.    int i,j,k,n;
  9.    printf(“Enter how many rows you want : “);
  10.    scanf(“%d”,&n);
  11.  
  12.    for(i=1;i<=n;i++)
  13.    {
  14.       for(j=1;j<=i;j++)
  15.          printf(” %d”,j%2);
  16.  
  17.       printf(n);
  18.    }
  19.    return 0;
  20. }

Output:


Similar Number Patterns:

Similar Star pattern programs :

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply