Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > yanghui triangle

Reply
Thread Tools

yanghui triangle

 
 
winfield301@gmail.com
Guest
Posts: n/a
 
      03-25-2006
how to print the follow one:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
.........................

 
Reply With Quote
 
 
 
 
Vladimir S. Oka
Guest
Posts: n/a
 
      03-25-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) opined:

> how to print the follow one:
> 1
> 1 1
> 1 2 1
> 1 3 3 1
> 1 4 6 4 1
> 1 5 10 10 5 1
> ........................


In ISO Standard C, it's fairly easy:

#include <stdio.h>

int main(void)
{
printf("1\n");
printf("1 1\n");
printf("1 2 1\n");
printf("1 3 3 1\n");
printf("1 4 6 4 1\n");
printf("1 5 10 10 5 1\n);
printf("........................\n");

return 0;
}

Or did you mean algorithmically? In which case:

- this is a wrong group, try comp.programming
- a fee is chargeable for doing homeworks

--
BR, Vladimir

I guess I've been wrong all my life, but so have billions of
other people... Certainty is just an emotion.
-- Hal Clement

 
Reply With Quote
 
 
 
 
santosh
Guest
Posts: n/a
 
      03-25-2006
(E-Mail Removed) wrote:
> how to print the follow one:
> 1
> 1 1
> 1 2 1
> 1 3 3 1
> 1 4 6 4 1
> 1 5 10 10 5 1
> ........................


printf("1\n1\t1\n1\t2\t1\n1\t3\t3\t1\n1\t4\t6\t4\t 1\n1\t5\t10\t10\t5\t1\n");

 
Reply With Quote
 
Vladimir S. Oka
Guest
Posts: n/a
 
      03-25-2006
santosh opined:

> (E-Mail Removed) wrote:
>> how to print the follow one:
>> 1
>> 1 1
>> 1 2 1
>> 1 3 3 1
>> 1 4 6 4 1
>> 1 5 10 10 5 1
>> ........................

>
>

printf("1\n1\t1\n1\t2\t1\n1\t3\t3\t1\n1\t4\t6\t4\t 1\n1\t5\t10\t10\t5\t1\n");

Sorry, this does not work as OP wants. Mind the spacing.

--
BR, Vladimir

OCCAM'S ERASER:
The philosophical principle that even the simplest
solution is bound to have something wrong with it.

 
Reply With Quote
 
santosh
Guest
Posts: n/a
 
      03-25-2006
Vladimir S. Oka wrote:
> santosh opined:
>
> > (E-Mail Removed) wrote:
> >> how to print the follow one:
> >> 1
> >> 1 1
> >> 1 2 1
> >> 1 3 3 1
> >> 1 4 6 4 1
> >> 1 5 10 10 5 1
> >> ........................

> >
> >

> printf("1\n1\t1\n1\t2\t1\n1\t3\t3\t1\n1\t4\t6\t4\t 1\n1\t5\t10\t10\t5\t1\n");
>
> Sorry, this does not work as OP wants. Mind the spacing.


You're right. Didn't read close enough.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cisco 1721 triangle whit 2 cisco 800 over isdn 128k Himselff Cisco 4 06-27-2005 12:42 PM
Load balancing over WAN triangle Will Cisco 3 02-22-2005 07:00 PM
Button Click events going into Bermuda Triangle, news at 10 Michael Johnson Jr. ASP .Net 2 12-11-2003 07:36 AM
2x2950 + 3745 in triangle Bartek Cisco 1 11-01-2003 08:07 PM
Sample config. for 827 on Sympatico HighSpeed or Golden Triangle? Brad Cisco 0 07-11-2003 03:44 AM



Advertisments