Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
544f3a48b0 | |||
759d668045 | |||
6c90998eea | |||
7cefc49c79 | |||
80ce43103e | |||
9df8a9c331 |
19
Source1.cpp
19
Source1.cpp
@ -0,0 +1,19 @@
|
||||
#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;
|
||||
}
|
||||
ëîë
|
||||
#include <iostream>
|
||||
int factorial(int n) {
|
||||
return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
|
||||
}
|
||||
int main() ûøãâðàãîûâòðàîûðâîàial: " << factorial(num) << std::endl;
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user