Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int x;
- cout<<"Enter a number: ";
- cin>>x;
- cout<<"The factors are: ";
- for(int a = 1; a<=x; a++)
- {
- if(x%a==0)
- cout<<a<<" ";
- }
- cin.get();
- return 0;
- }
Add Comment
Please, Sign In to add comment