View Full Version : مثلث خیام...
mojreeem
یک شنبه 08 اردیبهشت 1387, 13:08 عصر
سلام به همگی. کسی کد مثلث خیام پاسکال رو داره؟؟؟؟؟؟؟؟؟؟؟؟؟
ممنون میشم برام بزارین...:لبخندساده:
Nasliazma
یک شنبه 15 اردیبهشت 1387, 00:45 صبح
#include <iostream.h>
#include <conio.h>
void khayam(int n);
void main()
{
short satr=0;//tedat satri ke mokhay az mosalas chap shavad .
clrscr();
cout<<"Enter Number For Satr :";
cin>>satr;
for(int i=0;i<=satr;i++)
khayam(i);
getch();
}//end Main
//asle barname ine :)
// ||
// ||
// \\//
// \/
void khayam(int n)
{
int count=1;//shomareshe inke jomle chandome ?
long zarib=1;//mohasebe zarib jomle
cout<<zarib<<"\t";
for(int j=n;j>0;j--)
{
zarib=(j*zarib)/count;
count++;
cout<<zarib<<"\t";
}
cout<<"\n";
}
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.