Need a project done?

C++ Programming Developer

Search This Blog

Display all divisors of a number C++


C++ Display all divisors of a number.

#include <iostream>
using std::cout;
using std::cin;
using std::endl;

int main(){
cout << "Enter a number: "; int num; cin >>num;

for (int i = 2 ; i < num;  i++){
if (num % i == 0){
cout << i << endl;
}
}
return 0;
}
"Don't let anyone ever make you feel like you don't deserve what you want."