[cfe-dev] Generate a tree in C language.

Lukas Vogel lukedirtwalkerdev at gmail.com
Sat Mar 23 11:44:27 PDT 2013


Please only ask question related to clang on this mailing list.

For questions like yours please use stackoverflow or google or something
similar.

(This function will print the inverse of what you showed

void print_tree(int i){
  int k,l;
  for(k=i;k>=0;k--)
  {
    for(l=k;l>=0;l--)
    {
      printf("*");
    }
    printf("\n");
  }
}

)


2013/3/23 akhandal96 <akhandal96 at gmail.com>

> Hey,
> how to make a tree of the symbol "*"
> my code is
> #include <stdio.h>
> #include <conio.h>
> main(){
> clrscr();
>
> int a,b,c;
>   for(a=1;a<=10;a++)
>     {
>       for(b=1;b<=a;b++)
>        {
>            printf("*");
>             }
>                printf("\n");
>      }
> getch();
> }
>
> and the output of it is
> *
> **
> ***
> ****
> and it goes till the last line having 10 stars,I want the same but
> backwards,
> and it should be like this,a that a user inputs a value,say 15,then it
> should generate the tree having first line 15 stars and the 2nd line 14
> stars and so on till 1 star.
>
> Please,I am a newbie to C,its been few days only I had started
> learning,please reply soon.
>
> Thanks a ton
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/Generate-a-tree-in-C-language-tp4031110.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130323/bbe0e75f/attachment.html>


More information about the cfe-dev mailing list