+ Webmaster Destek Platformu Smf,Php,vbulletin,Seditio,Asp,php,Html » Programlama » PascalKonu:
 >>> Pascal Üçgeni <<<

Kullanıcı Adı: Beni Hatırla?
Şifre:

Reklamlar
Sayfa: [1]   Yukarı git
Konu: >>> Pascal Üçgeni <<<  (Okunma Sayısı 133 defa) Seçenekler Arama
« : 26 Nisan 2008, 20:16:18 »
Ritchien

Azimli Üye

***


Üye No : 47

Yas : 16

Cinsiyet : Bay


Webmaster Destek Bagımlılık Yaratan Forum!ADMİNCLUP... Nerden : İstanbul/taksim

Konu  : 112 Mesaj Sayısı: 178

Puan: 0
=)

Üyelik Bilgileri WWW
Offline

PASCAL kullanarak pascal üçgenini yaratma programı.
Program PascalTriangle;
uses crt;
{Give your regards to Yaşar Çilek, a wishful thank is enough}
{////////////////////////////////////////}
{This is where factorial is calculated}
function Factorial(n:longint):longint;
var
j,i:longint;
Begin
j:=1;
for i:= 1 to n do
j:=j*i;
Factorial:=j;
End;
{/////////////////////////////////////}

{//////////////////////////////////////////////////////////}
{This is where magic happens, each number on the table is calculated here,
with a little bit of math info you will recognize it}
function DoCombination(r,d:byte):real;
Begin
DoCombination:=Factorial(r)/(Factorial(d)*Factorial(r-d))
End;
{/////////////////////////////////////////////////////////////////////////////}


{This is the main program}
var
r:byte;
d:byte;
Begin
clrscr;
gotoxy(30,10);
textcolor(black);
textbackground(green);
write('Generating Table Now');
gotoxy(30,12);
write('Please Stand By...');
Delay(5000);
textcolor(black);
Textbackground(green);
clrscr;
For r:= 0 to 12 do {Notice that it is only 12 after 12 it just goes crazy}
Begin {Probably it is because of factorial function,but this is a simple program}
for d:=0 to r do
write(DoCombination(r,d):0:0,' ');
delay(200);
Writeln;
End;
textcolor(black+blink);
writeln('Done');
textcolor(black);
textbackground(green);
gotoxy(25,20);
write('Successfully generated 12 rows!!!');
ReadKey;
End.
Logged
Sayfa: [1]   Yukarı git
+ Webmaster Destek Platformu Smf,Php,vbulletin,Seditio,Asp,php,Html » Programlama » PascalKonu:
 >>> Pascal Üçgeni <<<
 
Gitmek istediğiniz yer:  

Powered by SMF 1.1.7 | SMF © 2006, Simple Machines LLC
Hersey

Theme Edit StromKiller |


Google ve orumceklerin son ziyareti Bugün 02:01:02