prompted to input a positive integer N.and than For every natural number M that is less than or equal to N,
its sapose to Generate a list of all divisors of M, and
Test to see if M is prime number.
this is what i got so far but i dont know how to get it to see if the numbers prime im really new to programming and any help would be greatly appriciated.
#include <iostream>
using std::cout;
int main()
{
int increment = 0;
int num;
cin<<num;
for(int i=0;i<=12;i++)
{
if(i==12)
num += 12;
num += increment;
cout<<num;
if(i!=3)
cout<<",";
increment++;
}
system ("PAUSE");
return 0;
}
the end programs sapose to looks like this
Input a positive integer : 5
Testing 1 ->
The divisors: 1
The number 1 is not a prime number.
Testing 2 ->
The divisors: 1 2
The number 2 is a prime number.
Testing 3 ->
The divisors: 1 3
The number 3 is a prime number.
Testing 4 ->
The divisors: 1 2 4
The number 4 is not a prime number.
Testing 5 ->
The divisors: 1 5
The number 5 is a prime number.