#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,i,j,p,t,k=0;
clrscr();
printf("Enter 1st number, n = ");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
p=1;
t=sqrt(i);
for(j=2;j<=t;j++)
if(i%j==0)
{
p=0;
break;
}
if(p==1)
k++;
}
printf("Total Prime number = ",k);
getch();
}
///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........