Program.exe has stopped working

This keeps crashing my visual 2010 c++.
Instead of saying error, it says c++ has stopped working.

Can you guys see whats wrong, with this code?

Or if its just my program.


#include<iostream>
using namespace std;
int main(){

int num,divide=0,sum=0;

cout<<"Please Enter A Number"<<endl;
cin>>num;


while(divide<=num){

if(num%divide==0){
sum=sum+divide;}
divide=divide+1;
}
cout<<"The Sum Is:\t"<<sum<<endl;

return 0;
}
Topic archived. No new replies allowed.