Logo 
Search:

C Programming Articles

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

Program to print number triangle in reverse pattern

Posted By: Can Kaya     Category: C Programming     Views: 25342

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 to print number 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 to print number triangle in reverse pattern Or get search suggestion and latest updates.

Can Kaya
Can Kaya author of Program to print number triangle in reverse pattern is from Istanbul, Turkey.
 
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!