hello I am quit new to C++ I was writing a code that could give out all prime numbers from 0 to 20 here is the code ,but the out was 4370436 I dont know what to do from here.and also I would some more examples on User-defined fuctions.any help will be appreciated.thanks,
#include<iostream>
using namespace std;
void avoideven();
int main()
{
int a;
void avoideven();
cout<<a<endl;
return 0;
}
void avoideven()
{
int a;//---is our prime number
int b;
int result;
for(i=1;i<20;i++)
{
result=a/b;
result=a/a;
if(result==a)//--that prime number is divisible by one
{
a++;
}
else if(result==1)//---prime number is divible by itself
{
a++;
}
cout<<a<<endl;
}