Why won't my C++ program work?

This is my current program:
#include <iostream>

using namespace std;

int sumdivisors (int divisor);
int prime (int numb);

int main(){
cout << "Number Divisors Prime" << endl;
int primesum = 0;
int primesum2 = 0;

for(int limit = 10; limit<=50; limit++){
cout << limit << " " << sumdivisors(limit) << " ";

if (prime(limit) == 1){
cout << " *";
primesum++;
primesum2 += limit;
}
//This ends the line after everything has been written
cout << endl;
}

cout << "The number of prime numbers is " << primesum << endl;
cout << "The average of the prime numbers is " << primesum2/primesum << endl;
return 0;
}

int sumdivisors (int divisor){
int sum = 0;
for(int numb = 0; numb<=divisor; numb++)
if(divisor%numb == 0)
sum += numb;
return sum;
}

int prime (int numb){
int divisorssum = 0;

for(int limit = 0; limit<= numb; limit++)
if (numb%limit == 0)
divisorssum++;

if (divisorssum > 2)
return 0;
else return 1;
}

It should work yet every time I run it, it only prints:

Last login: Mon Sep 29 20:29:07 on console
Christians-MacBook-Pro:~ Soul$ /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Soul/Documents/School/CISC/Assignment4/bin/Debug/Assignment4
Number Divisors Prime

Process returned -1 (0xFFFFFFFF) execution time : 0.187 s

It is supposed to show the number, the sum of the divisors and add a * if it is prime.
dont divide by zero.
I just glanced over it, but it seems you are dividing by 0 when divisorssum > 2.
Topic archived. No new replies allowed.