Logo 
Search:

C Programming Articles

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

Program to print triangle of numbers in reverse order

Posted By: Sophie Brown     Category: C Programming     Views: 18655

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

1
2 1
3 2 1
4 3 2 1

Code for Program to print triangle of numbers in reverse order 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=1;i<=n;i++)
        {
            for(j=i;j>=1;j--)
            printf("%d  ",j);
        printf("\n");
        }
        getch();
}




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



 Please Give The Value of N:  5


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

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


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

Sophie Brown
Sophie Brown author of Program to print triangle of numbers in reverse order is from London, United Kingdom.
 
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!