#include<iostream>
      using namespace std;
      int main ()
      {
          int num = 6, fact = 1;
          // Factorial of negative number doesn't exist
          // Read more here - https://www.quora.com/Is-the-factorial-of-a-negative-number-possible
          if(num < 0)
              cout << "Not Possible";
          else
          {
              for(int i = 1; i <= num; i++)
                  fact = fact * i;
          }
          cout << "Fact " << num << ": " << fact;
      }
      
      Cpp language logo

      factorial

      0

      0

      avatar
      Ayush Gupta

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.