Pattern 26 : C Program to print number pattern 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 2 3 4 5
 2 3 4 5
 3 4 5
 4 5
 5
Note : This program is one of the Series of Number pattern programs in C.

Program :

  1. #include<stdio.h>
  2. int main()
  3. {
  4.    int i,j,k,n;
  5.    printf(“Enter how many rows you want : “);
  6.    scanf(“%d”,&n);
  7.  
  8.    for(i=n;i>0;i)
  9.    {
  10.       for(j=(ni)+1 ; j<=;j++)
  11.          printf(” %d”,j);
  12.  
  13.       printf(n);
  14.    }
  15.    return 0;
  16. }

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...

4 Responses

  1. code for above program.
    #include
    int main()
    {
    int i,j,k,n;
    printf("Enter how many rows you want : ");
    scanf("%d",&n);

    for(i=n;i>0;i–)
    {
    for(j=n;j>=i;j–)
    printf(" %d",i);

    printf("n");
    }
    return 0;
    }

  2. Eniya Elango says:

    Write a program to print the given pattern.

    Input Format:
    Input consists of a single integer.

    Output Format:
    Refer sample output. There is a trailing space at the end of each line.

    Sample Input:
    5

    Sample Output:
    5
    4 4
    3 3 3
    2 2 2 2
    1 1 1 1 1

  3. Eniya Elango says:

    Write a program to print the given pattern.

    Input Format:
    Input consists of a single integer.

    Output Format:
    Refer sample outputs. There is a trailing space at the end of each line.

    Sample Input:
    5

    Sample Output:
    5 4 3 2 1
    5 4 3 2
    5 4 3
    5 4
    5

Leave a Reply