(String[] args)
| 3 | import java.util.Scanner; // To take input from user |
| 4 | public class PrimeNo { |
| 5 | public static void main(String[] args) { |
| 6 | // TODO Auto-generated method stub |
| 7 | Scanner sc = new Scanner(System.in); |
| 8 | int a, b; |
| 9 | System.out.println("Enter first value: "); |
| 10 | a = sc.nextInt(); |
| 11 | System.out.println("Enter last value: "); |
| 12 | b = sc.nextInt(); |
| 13 | int i, j, num = 0, c = 0; |
| 14 | System.out.println("List of prime numbers from " + a + " to " + b + ": "); |
| 15 | for (i = a; i <= b; i++) { |
| 16 | num = i; |
| 17 | c = 0; |
| 18 | j = 2; // Start checking from 2 |
| 19 | while (j < num) { |
| 20 | if ((num % j) == 0) { |
| 21 | c = 1; |
| 22 | break; |
| 23 | } |
| 24 | j++; |
| 25 | } |
| 26 | if (c == 0) { |
| 27 | System.out.println(num); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | } |
nothing calls this directly
no outgoing calls
no test coverage detected