fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n = 40;
  6. double fact = n;
  7. double power = n;
  8. for(size_t i = 1; i < n; i++)
  9. {
  10. fact *= i;
  11. if(i < 20)
  12. power*= n;
  13. }
  14. cout<<"n! = "<<fact<<endl;
  15. cout<<"n^20 = "<<power<<endl;
  16. cout<<fact + power<<endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
n!   = 8.15915e+47
n^20 = 1.09951e+32
8.15915e+47