Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
7f11891d67 | |||
5be49cd184 | |||
b4b050ffde |
12
Source1.cpp
12
Source1.cpp
@ -0,0 +1,12 @@
|
||||
#include <iostream>
|
||||
int factorial(int n) {
|
||||
return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
|
||||
}
|
||||
int main() {
|
||||
int num;
|
||||
std::cout << "Enter a number: ";
|
||||
std::cin >> num;
|
||||
std::cout << "Factorial: " << factorial(num) << std::endl;
|
||||
return 0;
|
||||
}
|
||||
ôûâôûâôûâ
|
Loading…
x
Reference in New Issue
Block a user