Logo 
Search:

C Programming Articles

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

Program that prints triangle in reverse pattern

Posted By: Harry Evans     Category: C Programming     Views: 11210

WRITE A PROGRAM TO GENERATE FOLLOWING FIGURE OF N LINES. INPUT N FROM KEYBOARD.
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1

Code for Program that prints triangle 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=i;j>=1;j--)
            printf("%d  ",j);
        printf("\n");
    }
    getch();
}



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

Please Give The Value of N:  5


5  4  3  2  1
4  3  2  1
3  2  1
2  1
1
  
Share: 


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

Harry Evans
Harry Evans author of Program that prints triangle in reverse pattern 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!