Latest Posts

Thursday, February 26, 2015

Program to print a number tree using C language

       Program To Print A Number Tree Using C 

This program uses for loop to perform 'n' iterations.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{ int i,j,n;
  clrscr();
  textcolor(GREEN);
  printf("Enter the range:\n");
  scanf("%d",&n);
  for(i=1;i<=n;i++)
  { for(j=1;j<=i;j++)
    { printf("%d",j);
     }
   printf("\n");
  }
  getch();
 }
The numbers in the tree can be changed by editing the value's which a in dark blue in the above code.

Please like,share and subscribe to my posts.

Thanks For Visiting.
no image
  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Top