Skip to content

Wrong factorial for negative numbers #1

Description

@PradyumnaKrishna

Issue
In factorial.cpp, the factorial calculated for negative number is wrong. Here is the output:

Enter a positive integer: -5
Factorial of -5 = 1

Expected Outcome
Factorial should be calculated for only positive number and exist for negative inputs.

Possible Fixes
Adding if-else condition may fix this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions