Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to print triangle of numbers in reverse pattern

Posted By: Joan Cooper     Category: C Programming     Views: 12004

WRITE A PROGRAM TO GENERATE FOLLOWING FIGURE OF N LINES.
INPUT N FROM KEYBOARD.

1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Code for Program to print triangle of numbers in reverse pattern in C Programming

#include<stdio.h>
#include<conio.h>
void main()
{
        int i,n,j;
        clrscr();
        printf("\n Please Give The Value of N:  ");
        scanf("%d",&n);
        for(i=n;i>=1;i--)
        {
            for(j=1;j<=i;j++)
            printf("%d  ",j);
        printf("\n");
        }
    getch();
}




****************************** OUTPUT *********************************


     Please Give The Value of N:  7


    1  2  3  4  5  6  7
    1  2  3  4  5  6
    1  2  3  4  5
    1  2  3  4
    1  2  3
    1  2
    1


***********************************************************************
  
Share: 


Didn't find what you were looking for? Find more on Program to print triangle of numbers in reverse pattern Or get search suggestion and latest updates.

Joan Cooper
Joan Cooper author of Program to print triangle of numbers in reverse pattern is from Denver, United States.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!