math expressions

Solutions on MaxInterview for math expressions by the best coders in the world

showing results for - "math expressions"
Sophie
06 Mar 2017
1#include<iostream>
2#include<cmath>
3#include<iomanip>
4
5unsigned long long factorial(unsigned long long );
6
7unsigned long long factorial(unsigned long long num){
8
9    if(num<=0)
10        return 1;
11
12    return num * factorial(num-1);
13}
14
15int main()
16{
17    std::cout<<"Enter number\t"<<std::endl;
18    unsigned long long num,number;
19    std::cin >> num;
20    std::cout<<std::fixed<<std::setprecision(9)<<factorial(num)/pow(num,num)<<std::endl;
21    
22}
23
24
25
similar questions
queries leading to this page
math expressions