Advertisement
Primitiv0

Factoring

Sep 10th, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int number, temp = 1;
  8.  
  9.     cout << "Enter the number to determine its factors : " << endl;
  10.     cin >> number;
  11.     cout << "The factors of " << number << " are : " << endl;
  12.     while (temp <= number)
  13.     {
  14.         if (not(number % temp))
  15.             cout << temp << " ";
  16.  
  17.         temp++;
  18.     }
  19.     cout << endl;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement