here I am finding the position of factor number
for example
when user enter runtime 10
1 2 5 10
and when the user enters the position of factor 3
then return the 3rd factor means 5
for example
when user enter the runtime 20
1 2 4 5 10 20
and when the user enters the position of factor 5
then return the 5th factor means 10
I create one program but one thing is remaining to find the factor number position
#include<iostream>
using namespace std;
int Factor(int n) {
int i,j=0;
for(i=1;i<=n;i++)
{
if(n%i==0) //10mod1=0 reminder
{
//j=i; //here i am storing the factor number
cout << i ;
}
}
return i;
}
int main()
{
int x;
cout << "Enter your factor number:";
cin >> x;
Factor(x);
return 0;
}
Live program link: https://onlinegdb.com/HJ4yAyXZw
now what I am trying to do find the factor number position
how to implement the logic of find the position of factor number
help