You are given a number N and find all the distinct factors of N.

 



You are given a number N and find all the distinct factors of N.




OURSHOPKEEPER









#include <iostream>
using namespace std;
int main()
{
    int Nni = 1count=0;

    cin >> N;
    for (int i = 1i <= Ni++)
    {
        if (N % i == 0)
        {
            count++;
        }
    }
        cout << count;
    cout << "\n";
    for (int i = 1i <= Ni++)
    {
        if (N % i == 0)
            cout << i << " ";
    }
}




    


Click on the above button to download the code.



Post a Comment

If you have furthur QUERIES please let us know

Previous Post Next Post