0% found this document useful (0 votes)
41 views

C

Uploaded by

ERMIAS Amanuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

C

Uploaded by

ERMIAS Amanuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <iostream>

using namespace std;

int main()

int n;

unsigned long long factorial = 1;

cout << "Enter a positive integer: ";

cin >> n;

if (n < 0)

cout << "Error! Factorial of a negative number doesn't exist.";

else {

for(int i = 1; i <=n; ++i) {

factorial *= i;

cout << "Factorial of " << n << " = " << factorial;

return 0;

You might also like