prime numbers
how I can write program print all prime numbers using by recusion function?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include<iostream>
using namespace std;
void prime(int x, int y){
for(int i=m; i<n; i++)
{
for (int i=1; i<m; i++)
{
if(i %m==0)
p=p+1;
}
if(p=2)
cout <<m <<endl;
}
}
int main()
{
int m, n;
cout <<"enter two numbers"<<endl;
cin>>m>>n;
prime(m, n);
return 0;
}
|
I need to edit code abov
Topic archived. No new replies allowed.