List all the Prime Numbers
#include<stdio.h> void main() { int n,i,j,flag; printf("\n\nEnter the limit\t:"); scanf("%d",&n); printf("\nThe prime numbers within the given limit:\n"); for(i=1;i { flag=0; for(j=2;j { if(i%j==0) { flag=1; break; } } if(flag==0) printf("%d\t",i); } } Output Print Download Code Output Enter the limit :60 The prime numbers within the given limit: 1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59