Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /************************************/
- /** 20140527 Exam 12 **/
- /** Maker : Yan **/
- /** E-Mail : [email protected] **/
- /** Date : 2014/05/27 am.11:40 **/
- /************************************/
- #include <stdio.h>
- #include <stdlib.h>
- int processing(int, int);
- void main()
- {
- int x = 0, y = 0;
- printf("C(x, y), please input number of x & y.\n");
- printf("Enter a number of x: ");
- scanf("%d", &x);
- printf("Enter a number of y: ");
- scanf("%d", &y);
- printf("Answer = %d.\n", processing(x, y));
- system("pause");
- }
- int processing(int x, int y)
- {
- if((y == 0) || (x == y))
- {
- return 1;
- }
- else
- {
- return processing(x - 1, y) + processing(x - 1, y - 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment