Answer:
#include <iostream>
using namespace std;
int main() {
int x;
cin>>x;
if (x>0){
for (int i=1;i<=x;i++){
if(x%i==0){
cout<<i<<" ";
}
}
}
else {
cout<<"write a positive num";
}
return 0;
}
Step-by-step explanation:
i first checked if the num is positvie if no you ask the user for a positive num
i used a loop to find the factors by dividing the entered number on every num from 1 to the num