#include<stdio.h> #include<math.h> int main() { int l, u, i; printf("Enter the two numbers l and u:\n"); scanf("%d %d", &l, &u); for(i = l; i <= u; i++) { isPrime(i, u); } return 0; } int isPrime(int num, int u) { long root = sqrt(u); int i; for(i = 2; i <= root; i++) { if(num % i == 0) break; } printf(num + " "); }

Here are the results:

This post has been edited by **thorax232**: 28 August 2013 - 11:37 AM