#include<stdio.h> #include<conio.h> void main() { int i, n=1, count; clrscr(); printf("\nPrime numbers between 1 and 50\n"); while(n<=50) { count=0; for (i=2; i<=n/2; i++) { if(n%i==0) { count++; break; } } if (count==0) { printf("\n%d",n); } n++; } getch(); } OUTPUT Prime numbers between 1 and 50 1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47