pyramid with numbers pattern 2 in c and javalanguage.

■》Code link -> click πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡




■ Program->

#include<stdio.h>
#include<conio.h>
void main()
{
    int n;
    clrscr();
    printf("enter the rows =");
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
    {
     for(int j=n-i; j>=1; j--)
      {
        printf(" ");
      }
     for(int j=1; j<=i; j++)
      {
        printf("%d ",j);
      }
      printf("\n");
    }
    getch();
}

■》Output->

Enter the rows =5
        1
      1  2
    1  2  3
  1  2  3  4
1  2  3  4  5
                    



Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.