Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 15th, 2005, 01:27 AM
Authorized User
 
Join Date: Mar 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mistry_bhavin
Default Pascal Triangle

I want a piece of CODE for generating pascal triangle.
Can any onle please help me with this ???

Reply With Quote
  #2 (permalink)  
Old November 15th, 2005, 01:32 AM
Authorized User
 
Join Date: Nov 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Paramesh
Default

Hi Bhavin,

We can help you with writing the code. but not just give the answer.
So, First, write an algorithm. and tell us your current status.

Regards, :D
Paramesh.

"Don't walk behind me; I may not lead.
 Don't walk in front of me; I may not follow.
 Just walk beside me and be my friend."
Reply With Quote
  #3 (permalink)  
Old November 15th, 2005, 01:43 AM
Authorized User
 
Join Date: Mar 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mistry_bhavin
Default

I write the following code ....
but it is not working properly

for(i=0;i<NUMBER;i++)
{
   for(j=0;j<=i;j++)
   {
      printf("%d \t",x(i,j));
   }
}

int x(int n, int k)
{
   if((k<=0) || (k>=n))
   {
      return 1;
   }
   else
   {
      return x(n-1,k) + x(n-1,k-1);
   }
}

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ faster than Pascal IvAnR C++ Programming 5 August 6th, 2005 12:08 AM
How to put Desc/Asc triangle symbol on List View? hplim18 VB How-To 1 May 10th, 2004 12:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.