Start New Discussion within our Software Development Community
#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();
    system ("pause");
    return 0;
}

Inline Code Example Here

I don't mean to be rude, but I feel that I need to point somethings out. This is far from what a modern C++ program should look like. If I had to guess, you are using Turbo C++, which is severely outdated. Also the use of outdated header files like conio.h is strongly discouraged. I recommend you get a compiler which is up-to-date and portable, like g++ from the GNU Compiler Collection. Also if you want your program to be portable, you have to make sure you avoid using platform-dependant functions like the system() function. When you run the program from within the command line, you won't be needing any "pause" functions, because when the program terminates your command line will still be open and you can see the output. Consider reading the book C++ Primer (5th Edition) by Stanley B. Lippman. You will acquire good and modern C++ habits and you will be introduced to the C++ 11 standard. The C++ 11 standard is a big leap for C++ and it is important that you grasp it as soon as possible so that your programming tasks can be done in a simpler and more efficient manner, as well as a stepping stone for the recently released C++ 14 standard. Once you get comfortable with the changes in the C++ 11 standard you will have absolutely no trouble following the future implementations and changes in the C++ language.

This article has been dead for over six months. Start a new discussion instead.