C Program To Print Prime Numbers Upto The Number You Want

How to write a C Program To Print Prime Numbers Upto The Number You Want in C Programming Language ?


Solution For C Program :

/*C Program To Print Prime Numbers Upto The Number You Want.*/


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,num;
clrscr();
printf("Enter the number where u want to stop prime==>");
scanf("%d",&num);
printf("\nYour Prime Numbers till %d are==>",num);
for(i=2;i<=num;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
break;
}
if(j==i)
printf("%d\t",i);
}
getch();
}

You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable




Learn More :