Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // helloworld.cpp
- #include <iostream>
- int faculty(int n ){
- if(n > 0)
- return n * faculty(n-1);
- else
- return 1;
- }
- int main(){
- int n, f;
- std::cout << "Calculate faculty of: ";
- std::cin >> n;
- f = faculty(n);
- std::cout << f;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement