Skip to content

Commit e792498

Browse files
authored
Merge pull request #12 from Codemon06/new-program
Counting prime numbers
2 parents 41470b6 + 6dcbab0 commit e792498

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Counting-Prime.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include<iostream>
2+
#include<conio.h>
3+
using namespace std;
4+
int main()
5+
{
6+
int n,m,l=0,i;
7+
cout<<"Enter the range:";
8+
cin>>m;
9+
cout<<"Prime numbers till "<<m<<" are: \n";
10+
for(n=2;n<m;n++)
11+
{
12+
l=0;
13+
for(i=1;i<=n;i++)
14+
{
15+
if(n%i==0)
16+
l++;
17+
}
18+
if(l==2)
19+
cout<<"=>"<<n<<endl;
20+
}
21+
getch();
22+
}

0 commit comments

Comments
 (0)