Bài toán về Tam Giác Pascal

125 views
Skip to first unread message

Ha Cong Hau

unread,
Nov 15, 2012, 8:48:05 AM11/15/12
to ky_thuat_...@googlegroups.com
Em viết chương trình trên VS 2012
mà e kiểm tra lại e gọi hàm đúng nhưng nó lại kêu lỗi tại output xin thầy giúp đở?




// TamGiacPasCal.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "conio.h"
#include "stdio.h"

long unsigned gt(int a)
{
return(a>1) ? a*gt(a-1):1;
}
long unsigned tohop(int n, int k)
{
return(gt(n)/(gt(k)*gt(n-k)));
}
long unsigned cbt(int n, int k)
{
return(tohop(n-1,k-1)+tohop(n-1,k));
}
void output(int n,int i,int j)

{
for (i=0;i<n;i++) printf("\n");
{
for (j=0;j<i;i++) printf("%ld\t",cbt(i,j));
}
}
int _tmain(int argc, _TCHAR* argv[])
{
int n;
scanf_s("%d",n);
output(n);
return 0;
}
Reply all
Reply to author
Forward
0 new messages