#include<stdio.h><br /> #include<conio.h><br /> <br /> int tohop(int n,int k)<br /> {<br /> if (k==0||k==n)<br /> return 1;<br /> else<br /> return tohop(n-1,k-1)+tohop(n-1,k);<br /> }<br /> <br /> main()<br /> {<br /> <br /> //Trang tri chuong trinh<br /> int i;<br /> printf("\t");<br /> for (i=1;i<30;i++) printf("* ");<br /> printf("\n\t\t CHUONG TRINH TINH TO HOP chapKcuaN\n\n");<br /> //Het doan chuong trinh trang tri<br /> <br /> int a,b;<br /> do<br /> {<br /> printf("\n\t- Nhap n_k: "); scanf("%d %d",&a,&b);<br /> if (b>a) printf("\t\t!! Ban nhap sai. k<n !!\n");<br /> }<br /> while (a<b);<br /> <br /> printf("\n\t=>To hop chap %d cua %d = %d ",b,a,tohop(a,b));<br /> <br /> <br /> printf("\n\n\n\n\t\t\t\t http://tvlaptrinh.blogspot.com");<br /> getch();<br /> return 0;<br /> }<br />
0 nhận xét:
Đăng nhận xét