Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int fact(int b)
- {
- if(b <= 1)
- //if the number is 1 then return 1
- return 1;
- else
- //else call the same function with the value - 1
- return b * fact(b-1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement