Please register or login. There are 0 registered and 1193 anonymous users currently online. Current bandwidth usage: 326.30 kbit/s December 11 - 06:34am EST 
Hardware Analysis
      
Forums Product Prices
  Contents 
 
 

  Latest Topics 
 

More >>
 

    
 
 

  You Are Here: 
 
/ Forums / Programming /
 

  Floyd's triangle 
 
 Author 
 Date Written 
 Tools 
Captain Jack Sparrow Apr 09, 2006, 02:21am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List Replies: 17 - Views: 14417
How do i build a floyd's triangle in C?

Floyd's triangle is this:

1
23
456
78910
1112131415
.......

Please give code or logic



*Raid on to the Black Pearl my friends*
Savvy!
Want to enjoy fewer advertisements and more features? Click here to become a Hardware Analysis registered user.
Shadow_Ops_Airman1 Apr 09, 2006, 03:00am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
what you want it in Binary or hexadecimal?

AMD Athlon XP-M 2500+ (133x14= 1867MHz) (209x11= 2299MHz)
DFI LP NF2 Ultra-B (Hellfire 3EG Rev2)
Antec SX800, Neo HE 500, 4 Antec 8CM Fans
Thermalright SI-97 1 Antec Tricool 12CM Fan
CL SB XFi Xtreme Music
2x Barracuda HDs (250/400)
2x Samsung Write
Captain Jack Sparrow Apr 09, 2006, 03:27am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
Both actually.

Whats the difference in the codes though?

*Raid on to the Black Pearl my friends*
Savvy!
Shadow_Ops_Airman1 Apr 09, 2006, 03:46am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List

Edited: Apr 09, 2006, 03:52am EDT

 
>> Re: Floyd's triangle
Hexadecimal requires only 1/4 of the characters of binary to create, Hexacecimal uses 16 characters, 0-9 and A-F PS are those Individual Characters or whole numbers

AMD Athlon XP-M 2500+ (133x14= 1867MHz) (209x11= 2299MHz)
DFI LP NF2 Ultra-B (Hellfire 3EG Rev2)
Antec SX800, Neo HE 500, 4 Antec 8CM Fans
Thermalright SI-97 1 Antec Tricool 12CM Fan
CL SB XFi Xtreme Music
2x Barracuda HDs (250/400)
2x Samsung Write
tara thakpa Sep 03, 2007, 09:30pm EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
code 4 floyd triangle:

main void()
{
int no;line_no=1;
printf("enter a number");
scanf("\n");
while(line_no<=n)
{
cnt=1
while(cnt<=line_no)
{
printf("%d \t",no++);
cnt++;
}
printf("\n")
line_no++
}
}

Bala krishnan Sep 30, 2009, 03:07am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
I want the coding for the following format

1

1 1

1 2 1

1 3 3 1

1 4 6 4 1

1 5 10 10 5 1

please send the coding to my mail id
krishs.bala@gmail.com

Plug & Play Sep 30, 2009, 07:56am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle

I want a busty how with great "Assets" but it aint gonna happen now is it.....savvy!

i5 2500K @ 4.8Ghz- Corsiar H50 WaterCooler- Coolermaster Realpower 1000w- Asus P8P67 Deluxe - Asus 6990 4GB - 8GB Corsair DDR3 2000Mhz - X-Fi Sound - 7.1 Surround Speakers - BenQ 24" TFT - G9x Mouse- G19 Keyboard
Sep 30, 2009, 04:42pm EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List

Edited: Sep 30, 2009, 04:46pm EDT

 
>> Re: Floyd's triangle
Bala krishnan (92386) said on Sep 30, 2009 at 12:07am PDT:
I want the coding for the following format

That's Pascal's Triangle: http://en.wikipedia.org/wiki/Pascal%27s_triangle

I just whipped this C code up for it: http://hardwareanalysis.com.pastebin.com/f3ca21fd8

Sample output:
Pascal's Triangle, first 8 rows

1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1


The number of rows it calculates is hardcoded, but you could make it a parameter (eg. pascals.exe -rows 12).
Seems to work well, but I doubt it's the most efficient way.

Shawn Langley Sep 30, 2009, 04:56pm EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
Mr Fly would you mind whipping me up the source for the next greatest OS to be created and pass it of as my own? ;)

Having voices in your head is normal. Listening to them, common. Arguing, acceptable. However, when you lose the argument, you're in trouble.
Sep 30, 2009, 04:58pm EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
toDo = Shawn.readThought();
executeAction(toDo);

^_^

Meats_Of_Evil Oct 01, 2009, 01:31am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
Damn McFly! And all this time I thought you only sat on your laptop and made grease monkeyscripts for us lmao!

Speaking of which... anything new ?

-------------------------------------------------------------------------------------------------------------------------
Everything I write is Sarcasm.
Plug & Play Oct 01, 2009, 10:24am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle


Ha, so did I. I bet you got little round john lennon type glasses and a white doctors coat on right now McFly.


HHEHE

i5 2500K @ 4.8Ghz- Corsiar H50 WaterCooler- Coolermaster Realpower 1000w- Asus P8P67 Deluxe - Asus 6990 4GB - 8GB Corsair DDR3 2000Mhz - X-Fi Sound - 7.1 Surround Speakers - BenQ 24" TFT - G9x Mouse- G19 Keyboard
Oct 01, 2009, 10:56am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
Meats_Of_Evil (57359) said on Sep 30, 2009 at 10:31pm PDT:
Damn McFly! And all this time I thought you only sat on your laptop and made grease monkeyscripts for us lmao!

^_^

Plug & Play (62078) said on Oct 01, 2009 at 07:24am PDT:
Ha, so did I. I bet you got little round john lennon type glasses and a white doctors coat on right now McFly.

Well, I've never done this before, but here's a picture of me:
http://img504.imageshack.us/img504/4172/mcfly.jpg

Xhan Mehmeti Nov 09, 2009, 08:49am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
can you do that , not for numbers , but if a sentence is given, how you can write it in floyd's triangle ,

P
LE
ASE
HELP
ME+++

and in the end if there is a gap of word, i should fill it with '+' , Can you help please

Rinciya Ibrahim Dec 03, 2010, 10:48am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
#include<stdio.h>
#include<conio.h>
void main()
{
int term=1,row,i,j;
clrscr();
printf("Enter the number of rows\n");
scanf("%d", &row);
for(i=0;i<row;i++)
{
for(j=0;j<=i;j++)
{
printf("%d ",term);
term++;
}
printf("\n");
}
getch();
}

nitin bisht Jul 15, 2012, 10:54pm EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
a
ba
aba
baba
ababa

mothow Jul 21, 2012, 10:37pm EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
spam reported

ASRock Z97 Extreme 4 / i7 4790K / Corsair H80i / 4x4GB Crucial Ballistix Smart Tracer DDR3 1600 / 1TB Western Digital Caviar Black / 240GB Mushkin Chronos Deluxe SSD / 2x Evga GTX 670 FTW 2GB in SLI / Sound Blaster Recon3D Fatal1ty / Corsair HX1000w
Dr. Peaceful Jul 22, 2012, 12:41am EDT Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Floyd's triangle
Damn man, the entire latest topics is filled with spammed threads! On the other hand, it's good for HWA, more bandwidth indeed! LOL ;)

Nice thread here anyway, McFly was the smarty pant again with his programming. XD


Write a Reply >>


 

    
 
 

  Topic Tools 
 
RSS UpdatesRSS Updates
 

  Related Articles 
 
 

  Newsletter 
 
A weekly newsletter featuring an editorial and a roundup of the latest articles, news and other interesting topics.

Please enter your email address below and click Subscribe.