#include <bits/stdc++.h>
      using namespace std;
      //main Program
      int main()
      {
          int num;
          cout << "Enter a positive number: "; cin >> num;
          cout << "Factors of " << num << " are: " << endl;  
          // finding and printing factors b/w 1 to num
          for(int i = 1; i <= num; i++)
          {
              if(num % i == 0)
                  cout << i << " ";
          }
      }
      
      Cpp language logo

      factors

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.