From 674401d11c52992ac4e77a8644472ddcc531fa71 Mon Sep 17 00:00:00 2001 From: Associateinbox <115349896+Associateinbox@users.noreply.github.com> Date: Tue, 18 Oct 2022 22:36:58 +0530 Subject: [PATCH] Create Factor.cpp --- Factor.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Factor.cpp diff --git a/Factor.cpp b/Factor.cpp new file mode 100644 index 0000000..90793cf --- /dev/null +++ b/Factor.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +int main() { + + int n, i; + + cout << "Enter a positive integer: "; + + cin >> n; + + cout << "Factors of " << n << " are: "; + + for(i = 1; i <= n; ++i) { + + if(n % i == 0) + + cout << i << " "; + + } + + return 0; + +}