Pattern 23: Basic Number Pattern program in C using for loop

Spread the love

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

Enter how many rows you want: 5
 1 2 3 4 5
 1 2 3 4 5
 1 2 3 4 5
 1 2 3 4 5
 1 2 3 4 5

Program Basic Number Pattern :

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

Output:

You may also like:

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