From 5da4679d1d3ac2349366d5be0cade684f92c74d6 Mon Sep 17 00:00:00 2001 From: 9284721673 <72208756+9284721673@users.noreply.github.com> Date: Fri, 2 Oct 2020 12:13:06 +0530 Subject: [PATCH] cpp to find LCM of given number --- Cpp to find LCM | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Cpp to find LCM diff --git a/Cpp to find LCM b/Cpp to find LCM new file mode 100644 index 0000000..d18c098 --- /dev/null +++ b/Cpp to find LCM @@ -0,0 +1,19 @@ +#include +using namespace std; + +int main() +{ + unsigned int n; + unsigned long long factorial = 1; + + cout << "Enter a positive integer: "; + cin >> n; + + for(int i = 1; i <=n; ++i) + { + factorial *= i; + } + + cout << "Factorial of " << n << " = " << factorial; + return 0; +}